[mongodb] Cannot start MongoDB as a service

These are the steps I followed to install mongoDB on windows 7

  1. download the .msi file from the mongodb site--> https://www.mongodb.com/download-center?jmp=nav#community and run it

  2. Wherever your mondoDb is downloaded (generally in the c drive Program Files folder), go to that folder and wherever is the bin folder in that same folder create your data folder and your log folder

3.Inside your data folder create your db folder

The structure would look something like this

  1. Now open command prompt as administrator.

  2. change your file path and enter the bin folder.( in this case it would be c>program files>MongoDB>bin> )

  3. Type in the following command : mongod --directoryperdb --dbpath "C:/Program Files\MongoDB\data" --logpath "C:\Program Files\MongoDB\log\mongo.log" --logappend --rest --install

  4. This would set the logpath and database path. Lastly run net start MongoDB . Hope this helps.