How to install MongoDB on Windows
In this tutorial, we will show you how to install MongoDB on Windows.
- MongoDB 2.2.3
- Windows 7
The MongoDB does not require installation, just download and extracts the zip file, configure the data directory and start it with command “
mongod“.1. Download MongoDB
Download MongoDB from official MongoDB website. Choose Windows 32 bits or 64 bits. Unzip, extracts to your prefer location, for example : d:\mongodb\.
2. Review MongoDB folder
In MongoDB, it contains only 10+ executable files (exe) in the bin folder. This is true, and that are the required files to MongoDB, it’s really hard to believe for a developer like me who come from a relation database background.
Figure : Files under $MongoDB/bin fo>lder

It’s recommended to add
$MongoDB/bin to Windows environment variable, so that you can access the MongoDB’s commands in command prompt easily.3. Configuration File
Create a MongoDB config file, it’s just a text file, for example : d:\mongodb\mongo.config
##store data here dbpath=D:\mongodb\data ##all output go here logpath=D:\mongodb\log\mongo.log ##log read and write operations diaglog=3
MongoDB need a folder (data directory) to store its data. By default, it will store in “
C:\data\db“, create this folder manually. MongoDB won’t create it for you. You can also specify an alternate data directory with --dbpath option.4. Run MongoDB server
Use mongod.exe --config d:\mongodb\mongo.config to start MongoDB server.
d:\mongodb\bin>mongod --config D:\mongodb\mongo.config all output going to: D:\mongodb\log\mongo.log
5. Connect to MongoDB
Uses mongo.exe to connect to the started MongoDB server.
d:\mongodb\bin>mongo MongoDB shell version: 2.2.3 connecting to: test > //mongodb shell
6. MongoDB as Windows Service
Add MongoDB as Windows Service, so that MongoDB will start automatically following each system restart.
Install as Windows Service with --install.
d:\mongodb\bin> mongod --config D:\mongodb\mongo.config --install
A Windows service named “MongoDB” is created.

To start MongoDB Service
net start MongoDB
To stop MongoDB Service
net stop MongoDB
To remove MongoDB Service
d:\mongodb\bin>mongod --remove

Hi I am getting following error while starting mongodb,please help me anyone
JavaScript execution failed: Error: couldn’t connect to server 127.0.0.1:27017 at
mongo.js:L112
exception: connect failed
I tried installing based on your tutorial,
but it’s waiting for the connections on port 28017, but never terminating.
What to do now??
Please help me.
Thanks in advance.
The command “mongod” will start the MongoDB server and listening on port, it waiting for client to connect. Use “mongo” to connect.
getting below error while running mongod.exe from Windows 32 bit Cmd Prompt (I have downloaded 32 Bit Version of mongo db i.e. mongodb-win32-i386-2.2.0.zip)
“procedure entry point interlockedCompareExchange64 coluld not be located in
DLL KERNEL32.dll”
Please refer..
https://groups.google.com/forum/?fromgroups#!topic/mongodb-dev/CnxCZgG_r4A
Hope that would help!
“Changed in version 2.2: MongoDB does not support Windows XP” Refer to this official guide
Thanks @Amol’s for the google link.
Hi,
During step 4 an error occurs saying Entry Point Not Found.
Please suggest me any solution.
Thanks in advance.
Sorry, don’t get you, can you provide the steps to simulate the problem?
it keeps on saying waiting for connections on port 20817…I deleted mongod.lock and tried again but nothing happend, what should I do?
open another command shell and move to mongodb directory then bin and execute mongo.exe it will work
‘
Do you plan on doing a series on MongoDB? Do you plan on using springData interface?
ya… will doing a series on MongoDB + Java + Spring and etc tutorials :) , MongoDB look promising noSQL database.