Hello World Mongodb | Basics of Installing and running the db

Just tried the mongodb and its all really interesting. Here are Basics of Installing and running the db on windows:

1. Download http://www.mongodb.org/downloads and extract. (In my case folder is d:\mongodb)
2. Create a db folder where the data will be stored. (c:\data\db)
3. Run Command prompt as administrator.
4. In command prompt run: d:\mongodb\bin\mongod.exe –dbpath c:\data\db
(Note – here you have to specify the db path as well. Here you will see message “waiting for connections..” message)

Running the Mongo DB

5. Run another Command prompt as administrator. (Note – keep the previous command prompt open)
6. In this command prompt run: d:\mongodb\bin\mongo.exe
You will see message like “MongoDB shell version 2.2.2
connecting to: test”

Running the Mongo DB-2

7. Create table:

db.TABLENAME.insert( {

NAME: “sumit2”,

age: 28

} )

8. Retrieve table:

db.TABLENAME.find()

MongoDB - Insert and retrieve statements

If you already have the basic knowledge of SQL, then you should read SQL to MongoDB Mapping Chart – http://docs.mongodb.org/manual/reference/sql-comparison/ . You will be able to understand the mongodb statements easily.