Last Updated: February 25, 2016
· harshadkale

mongodb as Windows Service

The other day I tried my best to follow the instructions on the official website to intall mongodb as a Windows Service. Somehow I couldn't get through it.

Here are the simplest steps to do that -

  1. Download mongodb Windows (x84 / x64, according to your needs) package.

  2. Extract it to your convenient directory, for me it was C:\mongodb (I will reference paths in steps ahead w.r.t. my path)

  3. Check if you have log directory inside mongodb, if not create it and create mongodb.log file inside it.

  4. Go to C:\mongodb\bin directory.

  5. Type cmd -
    mongod.exe --dbpath=C:\mongodb\data --logpath=C:\mongodb\log\mongod.log --install

  6. Type cmd - services.msc

  7. Start service named "MongoDB" and, configure it to Autostart with Windows, if you do not want to manually start it every time you reboot Windows.

  8. Boom!