Mongodb database storage problems

 

MongoDB database by default in Windows directory is c: \ data. If in case the directory is not directly run mongod.exe, it will report the following error (and did not set mongodb service, so the form of the command line to start, Note: The command here is to be installed in the bin directory mongodb directory in execution):

 

In some cases, we do not want mongoDB database on the c disk, you can use the following method to switch database directory: specify the database path when you start the service open

mongod.exe –dbpath d:\data

 

Behind --dbpath you want to store files in the database, you can imagine him as a warehouse, which stored all of the database project. If you then develop two projects at the same time, you can create two such "warehouse", two projects are stored respective databases, so that neither the conflict, but also conducive to find.

After executing the command, "warehouse" where these files are generated:

 

Then connect mongodb service, after which the database you create are placed when you start the service specified by the "warehouse" in

 

 (Ps: welcome to feel free to correct me wrong Gangster .... xixi)

 *************** short step a thousand miles ***************

Guess you like

Origin www.cnblogs.com/liangxiyang/p/11619129.html