Monday, 11 August 2014

MongoDB Setup ( installation ) and access through command line too and GUI based client

One of the most commonly used Non-Sql database these days is MongoDB. Last week I had a chance to try on it and have found it so easy to make it setup in the system. It is just a three step process to follow and make it working and play with it :

1) First download latest MongoDB zip file from here ( MongoDB ) and extract its contents at C:\Program Files\MongoDB.

2) Create new directory at C:\data\db , which is default directory for MongoDB to store its database files.

3) Now double click mongod.exe from C:\Program Files\MongoDB\bin location, and MongoDB server will be started to listen as shown in figure :


And that's it, you have successfully setup the MongoDB on your system, you can now perform operations in two ways :

1) Through Command Line tool : for command line tool go to C:\Program Files\MongoDB\bin and double click mongo.exe and start executing your commands there. For commands you can follow MongoDB's official documentation at : http://docs.mongodb.org/manual/reference/command/, to start as basic from command line you can perform CRUD operations by following steps here : http://www.mkyong.com/mongodb/how-to-create-database-or-collection-in-mongodb/


2) Using UI Client for MongoDB : you can use any freeware UI client available for MongoDB, I will prefer Robomongo, its free and extensive, you can download its free copy from : http://robomongo.org/, and here is my post about it : http://usmansidea.blogspot.com/2014/08/robomongo-asesome-mongodb-ui-client-to.html. After installation just run it for the first time and give connection name and don't change any default settings and click save.

That's all about how to setup MongoDB and how to play with it, so lets enjoy :)

What's Next : I am currently working on C# sample project to access MongoDB in both simple way and through repository pattern, will create next post on it, till then stay tuned and happy codding :)