Mongodb – Difference between net start MongoDB and mongod

jsonmongodbnosqlwindows

According to MongoDB documentation,when running mongodb community edition, it states you can start mongo service using mongod, or net start MongoDB.

Either is required to access the mongo shell.

Can someone explain the difference between using mongod and net start MongoDB

Best Answer

You can always run mongod with a command. But if you decide to run mongod as a Windows service, in first step you need to set up a service by running mongod with --install option:

"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --config "C:\Program Files\MongoDB\Server\3.4\mongod.cfg" --install

Then, you can use net start/stop to use the installed service:

net start MongoDB