1. start MongoDB normally
Once you have installed MongoDB on your PC, you can start MongoDB using
mongod --dbpath C:\MongoDB\Server\3.6\data\db
2. start MongDB as service
- remove the existing MongDB service
- intall the MongoDB as a service
- start the MongoDB service
- stop the MongoDB service
mongod --remove mongod --dbpath=C:\MongoDB\Server\3.6\data\db --logpath=C:\MongoDB\Server\3.6\logs\log.txt --install net start MongoDB net stop MongoDB
When you install or remove MongoDB service to or from you computer, you can add the
--serviceName YourServiceName flag after the command to customize the
service name as you wish.
If needed, you can install services for multiple instances of mongod.exe. Install each service with a unique –serviceName and –serviceDisplayName. Use multiple instances only when sufficient system resources exist and your system design requires it.