Friday, 16 January 2015

installing MongoDB

First download  MongoDB
Select the suitable version for your system. 
Download either .zip or .msi, msi handles everything automatically 
install into a  folder

Getting Started:

If u go into the bin folder of the mongodb u'll find a lot of executable files
some of notable ones are
1.mongod
2 mongo
3 mongostat
4 mongoimport
5 mongodump
6 mongoexport   and so on....

we are gonna explore each of these as we proceed


For windows users
to start mongodb
1. open ur cmd(windows+R then type cmd and hit enter)
2. then go to the bin directory in cmd using shell commands(cd , cd.. ,cd\ and so on )
3. then type mongod --dbpath (urdbpath)

mongod handles data requests, manages data format, and performs background management operations
So by this command(mongod --dbpath) u are telling the mongodb to store ur database in a specific folder
For example i am storing my database in D:\test\mongodb\data. So my command will be
mongod --dbpath D:\test\mongodb\data

If the command is correct u should see various info printed like version number, your system properties and so on.

4. open another cmd
    go to the bin folder as done above
    then simply type mongo.exe
    you are in the mongo shell now!!!

To test if u are sucessfully connected, just type in  db;
if this returns "test" onto the shell, everything is woking properly!!

We need both the instances of cmd(mongod and mongo)simultaneously for working













No comments:

Post a Comment