Download a ZIP file containing the appropriate version of MongoDB from MongoDB.org.
Install MongoDB for Windows
In Windows Explorer, locate the downloaded MongoDB .msi file and double click .msi file. By default it will installed MongoDB to C:\mongodb.
Setup MongoDB environment
MongoDB requires a data directory to store all data. MongoDB’s default data directory path is C:\MongoDB\data\db. Create folder using Command Prompt.
Command :- md \data\db
Start MongoDB
To start MongoDB, run mongod.exe. For example, from the Command Prompt.
Command :- C:\mongodb\bin\mongod.exe
Connect to MongoDB
You should see output something like the following:
C:\mongodb\bin\mongod –dbpath c:\mongodb\data\db
Thu Oct 01 08:27:43.083 [initandlisten] MongoDB starting : pid=8608 port=27017 dbpath=c:\mongodb\data\db 64-bit host=s2ua3031x9m
Thu Oct 01 08:27:43.084 [initandlisten] db version v2.4.8
Thu Oct 01 08:27:43.084 [initandlisten] git version: a350fc38922fbda2cec8d5dd842237b904eafc14
Thu Oct 01 08:27:43.085 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack=’Service Pack 1′) BOOST_LIB_VERSION=1_49
Thu Oct 01 08:27:43.085 [initandlisten] allocator: system
Thu Oct 01 08:27:43.085 [initandlisten] options: { dbpath: "c:\mongodb\data\db"}
Thu Oct 01 08:27:43.122 [initandlisten] journal dir=c:\mongodb\data\db\journal
Thu Oct 01 08:27:43.123 [initandlisten] recover : no journal files present, no recovery needed
Thu Oct 01 08:27:43.206 [FileAllocator] allocating new datafile c:\mongodb\data\db\local.ns, filling with zeroes…
Thu Oct 01 08:27:43.207 [FileAllocator] creating directory c:\mongodb\data\db\_tmp
Thu Oct 01 08:27:43.246 [FileAllocator] done allocating datafile c:\mongodb\data\db\local.ns, size: 16MB, took 0.037 secs
Thu Oct 01 08:27:43.247 [FileAllocator] allocating new datafile c:\mongodb\data\db\local.0, filling with zeroes…
Thu Oct 01 08:27:43.373 [FileAllocator] done allocating datafile c:\mongodb\data\db\local.0, size: 64MB, took 0.125 secs
Thu Oct 01 08:27:43.374 [initandlisten] command local.$cmd command: { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 reslen:37 167ms
Thu Oct 01 08:27:43.375 [initandlisten] waiting for connections on port 27017
Thu Oct 01 08:27:43.375 [websvr] admin web console waiting for connections on port 28017
To verify that you can connect to the new MongoDB server, open a second command window and execute c:\mongodb\bin\mongo.