Monday, October 12, 2015

How to Install and Run MongoDB on Windows

This particular article is for those who are going to install and run MongoDB database for the first time.

  • First, download MongoDB from official MongoDB website

  • Once you done Unzip and put its content to your location, for instance C:\MongoDB\ 

  • This is how MongoDB server directory tree looks like after extraction

  • mongodb-directory-structure

  • Then go to C:\MongoDB\Server\config\ and create MongoDB configuration file - mongo.config 

  • Fill in corresponding data, for example this is content of my mongo.config:

                                   ## database directory
                                   dbpath = c:\MongoDB\Server\data

                                   ## database port number
                                   port = 27017

                                   ## logs will be created here
                                   logpath = c:\MongoDB\Server\logs\mongo.log

  • Now you're ready to run your MongoDB server! Last thing to do is to create a shortcut to mongod.exe (C:\MongoDB\Server\3.0\bin\mongod.exe), with following parameter:

                                 --config C:\mongodb\server\config\mongodb.conf

This is it! Now, by clicking on this shortcut you're starting MongoDB server with parameters you set previously in mongo.config file. 

I also suggest to use Robomongo management tool for observing data in your MongoDB. It is free.
Enjoy codding and if you got any questions please do not hesitate to ask in the comments!

Good Luck! 

No comments:

Post a Comment