How to Install MongoDB on Windows


You can download the latest release of MongoDB from http://www.mongodb.org/downloads, Make sure you get the correct version of MongoDB depending upon your windows version.
32-bit versions of MongoDB only support databases smaller than 2GB and suitable only for testing and evaluation purposes.
Now extract your downloaded file in any drive suppose we extract it in c:\\ drive, after extract file you will see a folder “mongodb-win32-x86_64-[version]” Here [version] is the version of MongoDB downloaded. You can rename this file name.
Now open the command prompt and run the following command.

[Your mongodb file location]\bin mongod 
 for example  C: \MongoDB\bin mongod

MongoDB require the folder “data\db” inside MongoDb folder location, the default location for the MongoDB data directory is c:\ MongoDB \data\db.
If you have installed the MongoDB at different locations, then you need to specify an alternate path for \data\db by setting the path dbpath in mongod.exe. For the same issue following commands
In command prompt navigate to the bin directory present into the MongoDB installation folder. Suppose my installation folder is D:\set up\mongodb.

C:\Users\XYZ>d:
D:\>cd "set up"
D:\set up>cd mongodb\bin
D:\set up\mongodb\bin>mongod.exe --dbpath "d:\set up\mongodb\data"

If everything going well it will show a message “Waiting for Connection”. Now open a new command prompt and run the following command.

D:\set up\mongodb\bin>mongo.exe
MongoDB shell version: 2.4.7
Use test
>db.test.save( { a: 1 } )
>db.test.find()
{ "_id" : ObjectId(5879b0f65a56a454), "a" : 1 }

This will show that MongoDB is installed and run successfully. Next time when you run MongoDB you need to issue only commands.

D:\set up\mongodb\bin>mongod.exe --dbpath "d:\set up\mongodb\data"
D:\set up\mongodb\bin>mongo.exe

Note: 32-bit versions of MongoDB only support databases smaller than 2GB and suitable only for testing and evaluation purposes.

1 comment:

  1. The information you posted here is useful to make my career better keep updates...If anyone want to get Oracle Training in Chennai, Please visit Training in Bangalore Located at Bangalore which offer best Oracle Training in Bangalore.Visit Us, Oracle Training in Bangalore

    ReplyDelete

Please do not enter any spam link in the comment box.

NUnit : Introduction

There are several unit test tools in the market, but one of them is NUnit, the most popular tool for doing unit testing. So in this tutorial...