Document directory
- Original Method
- Configuration file Method
- Daemon Method
Original Method
The MongoDB function can be used only when the MongoDB service is started. Normally, a command window is opened and the following command is entered to start the service:
Configuration file Method
If you do not want to enter a lot of complex parameters in the command line during each startup, you can save the parameter information in the configuration file. Create a configuration file named MongoDB. CnF in the same directory as those gadgets. The content of the file is as follows:
Dbpath = "D: \ database \ MongoDB \ data"
Then, enter the following command in the Command window to start the service.
It seems similar to the above method. You still need to specify the configuration file. However, if the parameter is more than-dbpath, you can write the parameters in the configuration file, it is much more convenient to call the command line.
Daemon Method
To start a service in the two methods described above, you must open a command line window. If the window is closed, the service will be stopped. We can use the -- fork parameter to run MongoDB services in the background, which is relatively safe. The -- fork parameter is used with the -- logpath parameter.