This BLOG is not managed anymore.

How to Install MongoDB (NoSQL database) on Windows 7?

In this post i am gonna show you how to install MongoDB, a NoSQL Database, on Windows.

First of all download Related version of MongoDB from http://www.mongodb.org/downloads.There are three types of build is available for windows.

  • 64-bit 2008R2+, Use this build if you are running with 64-bit Windows Server 2008 R2, Windows 7, or greater.
  • 64-bit, Use this, If you are using 64-bit version of windows.
  • 32-bit, Use this, If you are using 32-bit version of windows.

You can check your operating system architecture by - 1) Right click on "My Computer" > Property OR 2) Running wmic os get osarchitecture command in command prompt

After downloading ZIP file, Unzip it. Run this command "move C:\mongodb-win32-* C:\mongodb" ,just to change complex name of folder to "mongodb".

MongoDB requires data folder to store its data. MongoDb stores data in db folder created inside the data folder. This folder will not be created automatically, you have to create it manually.

Now default path for this data directory should be C:\data\db but you can Specify alternate path using following command C:\mongodb\bin\mongod.exe --dbpath "d:\test\data"

Starting MongoDB server from command prompt

To Start MongoDB server from command prompt run C:\mongodb\bin\mongod.exe command. This will start MongoDB server. Prompt will show waiting status. By default server will run on localhost port no 27017. You can change port by starting server using C:\mongodb\bin\mongod.exe --port PORTNO command.

To connect with server we will use mongo.exe shell. Run C:\mongodb\bin\mongo.exe command.

Thats All !!. Now Every time you want to use MongoDB, you have to start server and then run mongo.exe shell. To avoid doing this, you can run MongoDB service , which will start every time windows boot.

Running MongoDB server as a windows service:

To install service run following command, mongod --bind_ip IPADDR --logpath "d:\test\log\mongodb.log" --logappend --dbpath "d:\test\data\db" --port PORTNO --serviceName NAMEofSERVICE --serviceDisplayName "SERVICEDISPLAYNAME" --install. Every attribute in this command is easily understood.

To start service you can use net start NAMEofSERVICE command. And to stop service you can use net stop NAMEofSERVICE command.

If every thing goes well, you have successfullly installed MongoDB on your windows Machine.

Was this Information helpful?

Yes No


8 comments: