It is inconvenient to start MongoDB every time you run Mongod--dbpath d:/mongodb/data command line, just like I don't install MySQL, I want to use it as a Windows service, so it's much easier.
D:\mongodb\bin>mongod--logpath D:\MongoDB\logs\MongoDB.log--logappend--dbpath D:\MongoDB\data--directoryperdb --servicename MongoDB--install
All output Going To:d:\mongodb\logs\mongodb.log
Creating service MongoDB.
Service creation successful.
Service can is started from the command line via ' net start ' MongoDB '.
Note: This command to the MongoDB Bin directory to run, at the beginning, I was directly under the D:\ run, the results of the service executable directory is "" D:\mongod "--logpath" D:\MongoDB\logs\MongoDB.log "-- Logappend--dbpath "D:\MongoDB\data"--directoryperdb--service ", certainly is wrong.
The command line specifies the log file: D:\MongoDB\logs\MongoDB.log, the log is output in an append manner;
Data file directory: D:\MongoDB\data, and the parameter--directoryperdb indicates that each DB will create a new directory;
Name of the Windows service: MongoDB;
The above three parameters can be based on their own circumstances, hehe.
Finally, the installation parameters:--install, the opposite is--remove
Start Mongodb:net start MongoDB
Stop Mongodb:net Stop MongoDB
MongoDB Install Windows Services