Tuesday 20 January 2015

Setting up MongoDB on Windows 8.1

If you have decided to learn MongoDB you have made a great move. 

Advantages of MongoDB over RDBMS:
  • Schema less : MongoDB is document database in which one collection holds different different documents. Number of fields, content and size of the document can be differ from one document to another.
  • Structure of a single object is clear
  • No complex joins
  • Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that's nearly as powerful as SQL
  • Tuning
  • Ease of scale-out: MongoDB is easy to scale
  • Conversion / mapping of application objects to database objects not needed
  • Uses internal memory for storing the (windowed) working set, enabling faster access of data


Why should you use MongoDB:

  • Document Oriented Storage : Data is stored in the form of JSON style documents. 
  • Index on any attribute. 
  • Replication & High Availability. 
  • Auto-Sharding. 
  • Rich Queries. 
  • Fast In-Place Updates. 
  • Professional Support By MongoDB. 

Click on this link to download MongoDB. You'll be redirected to the MongoDB downloads page.
Download Windows 32 bit zip file from the page.

Go to your Downloads folder. You'll find a zip file named - 'mongodb-win32-i386-2.6.7.zip'.
Extract it and rename the extracted folder to 'MongoDB'.

Now move this 'MongoDB' folder you have just renamed to your C:\ drive. 


In  C:\ Drive create a folder named as 'data' (all letters in lower case). 


Create another folder name 'db' inside the 'data' folder.

Now you are all set to run MongoDB. data/db is the directory where MongoDB stores its database.

You can press WindowsKey + R. A Run terminal will appear. Type cmd in it and press Enter to open the command prompt.

A black box like thing will pop up. It is called the Windows Command Prompt.

Type the few commands in it in the below given sequence  to run MongoDB.

cd C:\MongoDB\bin

mongod



After entering the above commands the 'mongod' server will start. Now minimize this window(i.e. the command prompt shown above)

After minimizing open another command prompt using the same steps shown above and change your directory C:\MongoDB\bin again.

Now type 'mongo' to start the mongo terminal where you write you mongoDB queries. 

Warning: Do not close the mongod terminal. If you do so the mongo command-line shell will not function.

That is it. Your MongoDB is all set.

If you don't know what mongo and mongod are I would recommend you read this. It is short and precise.

Please leave a comment below if it worked for you. Thank You. :D




No comments:

Post a Comment