Getting MongoDB up and running on Windows

Getting MongoDB up and running on Windows

MongoDB is the most popular and widely used NoSQL database(source: It is free, open source and supports all major platforms(Windows, Linux, etc.).
In this post I will take you through the installation of MongoDB on Windows. Although I have used Windows 8 for demonstration but the process explained applies to other Windows distributions(Windows 7, 2008 server etc.) as well.
Download the latest MongoDB distribution from suitable for your machine architecture(32/64 bit).
Run the installer

Create mongo.config in C:\MongoDB folder with following content


You have to create data and log folders manually, it won’t be created automatically. dbpath points to directory where mongodb will keep its database files.

Start MongoDB as Windows service
Run the following commands on command prompt as Administrator in mongodb bin folder (C:\MongoDB\bin)

mongod --config C:\mongodb\mongo.config --install

and then to start the service

net start MongoDB

Connect to MongoDB
You can connect to MongoDB by running mongo.exe if MongoDB server has been started.

“show dbs” command lists all the databases available.
And we are done 🙂

If you want to run mongo commands from any location consider adding C:\MongoDB\bin to path under system variables.

Hope you liked this post. Thank you 🙂