You are on page 1of 2

MongoDB Installation on Windows

1. Download the latest production release of MongoDB from www.mongodb.com


2. Install the downloaded file
3. Setup the mongodb environment
MongoDB requires data directory to store all data. Create this folder by running the following
command in a Command Prompt:
md \data\db
4. In command prompt, Specify the following path where the MongoDB is installed
cd C:\Program Files\MongoDB\Server\3.4\bin //Press Enter
mongod.exe –dbpath D:\data\db
5. Open another terminal in command prompt
cd C:\Program Files\MongoDB\Server\3.4\bin //Press Enter
mongo.exe

RoboMongo setup
RoboMongo is modern,robust and community driven GUI for MongoDB.

1. Download RoboMongo from https://robomongo.org/ and install it.


2. In order to establish connection to RoboMongo :
Open command prompt,
cd C:\Program Files\MongoDB\Server\3.4\bin //Press Enter
mongod.exe –dbpath D:\data\db

Open another terminal in command prompt


cd C:\Program Files\MongoDB\Server\3.4\bin //Press Enter
mongo.exe
3. Open RoboMongo tool , it will ask to create a new connection by specifying some name
to the connection and then press connect .

Importing and Exporting Database and Collections


For importing and exporting any database or collections,firstly open command
prompt. Specify the MongoDb the path where MongoDB is installed

cd C:\Program Files\MongoDB\Server\3.4\bin //Press Enter


1. Importing/Exporting Database
 Export entire database
mongodump –d db_name –o outputdirectory

 Import entire database


mongorestore -d db_name path_to_db

2. Importing/Exporting Collections
 Exporting collection
mongoexport –d db_name –c collection_name –o out.json

 Importing collection
mongoimport –d db_name –c collection_name out.json

You might also like