MongoDB Installation | starting server | Connecting mongo shell

1. Download MongoDB

Goto and download the latest version of MongoDB.

MongoDB installation directory : c:/Program files/mongodb/bin/

2. Create data directory to store mongodb files

Create a new directory data in c:/data/db

MongoDB data directory : c:/data/db

3. Starting Mongodb server

Now open command prompt in mongodb/bin directory and run

C:/Program files/mongodb/bin>mongod --dbpath d:/data/db

Note: - You can open command prompt from a particular folder by pressing SHIFT+RIGHT CLICK, you can see "OPEN COMMAND WINDOW HERE", in the toolbar.


3. Connecting Mongo shell with mongod

To open a mongo client, Open one more command prompt and configure the port number of the mongod server with the following command. 

C:/Program Files/Mongod/bin>mongo --port 27017

27017 is the port number of the server.

Related Post