A journey to .Net

Installing MongoDB as a Windows Service

Wednesday, 27 April 2016 21:20 by mBerube
(Also available in: français)

For a new project, I decided to give MongoDB a try. It works great but I always have to look for the documentation to install MongoDB as a Windows Service so as a reminder for me (and also for you dear readers), here's the steps :

  • Download MongoDB from https://www.mongodb.org/downloads
  • Run the installer
  • Create a data folder. It can be anywhere on the disk but for dev purpose, the same folder as the mongo installation is good. In it, create 2 subfolders, db and logs
  • Create a configuration file (for this exemple c:\devtools\mongodb\mongod.cfg) to configure paths for database and log folders. Ex:
    destination: file
    path: C:\DevTools\MongoDB\data\log\mongod.log
    dbPath: C:\DevTools\MongoDB\data\db

  • In a command prompt (as administrator), use the following command : .\bin\mongod.exe --config c:\devtools\mongodb\mongod.cfg --install
  • Make sure the service is running and is set to automatic start by opening the service window (services.msc)
  • To test that your installation of mongoDB is working, you can use the fantastic Robomongo tool, a UI interface to MongoDB

That's it. Please give it a try and for further informations, you can see the mongoDB official windows installation documentation page. To learn more about how to use MongoDB in .Net, you can see the great Wes Higbee Pluralsight course Using MongoDB with ASP.Net MVC

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRss comment feed