Supporting MongoDB

MongoDB is a scalable, high performance, open source, document-oriented database written in C++.

logo

The database is document-oriented so it manages collections of JSON-like (JavaScript Object notation) documents. Many applications can thus model data in a more natural way, as data can be nested in complex hierarchies and still be query-able and indexable.

It is an Unrelational, NoSQL database with the closest RDBMS probably MySQL. A good description i found for explaining what MongoDB is…

If you take MySql, and change the data model from relational to document based, you get a lot of great features: embedded docs for speed, manageability, agile development with schema-less databases, easier horizontal scalability because joins aren’t as important

-Eliot and the core MongoDB Team

Installing

We have installed on Linux. more information here

Connecting to MongoDB

The DB can be easily connected to via command prompt.

H:\>C:\Users\me\Desktop\mongodb-win32-x86_64-1.8.3-rc1\bin\mongo.exe mymongodbserver

Once connected, the chevron (>) will appear

MongoDB shell version: 1.8.3-rc1
connecting to: devmogo.domain.net/test
>

Some commands while trialling

To create a new DB is very simple

> use dbatemp

The above syntax will switch to the DB if it exists, if not it will create the new DB.

> show dbs
admin (empty) dbatemp 0.203125GB
local (empty) > use dbatemp
switched to db dbatemp

> show collections
dbatemp
system.indexes

> db.dbatemp.find(); { "_id" : ObjectId("4e4bd13d02a334bc80fd344f"), "name" : "Ronaldo" } { "_id" : ObjectId("4e4bd46fd424e8988c136a71"), "name" : "Mos!!!" } > db.dbatemp.update({"name" : "Mos!!!"}, {"name" : "MohsinWasHere", "Title" : "Mr"}); > db.dbatemp.find(); { "_id" : ObjectId("4e4bd13d02a334bc80fd344f"), "name" : "Ronaldo" } { "_id" : ObjectId("4e4bd46fd424e8988c136a71"), "name" : "MohsinWasHere", "Title" : "Mr" } > show collections
dbatemp
system.indexes

> db.dbatemp.find(); { "_id" : ObjectId("4e4bd13d02a334bc80fd344f"), "name" : "Ronaldo" } { "_id" : ObjectId("4e4bd46fd424e8988c136a71"), "name" : "MohsinWasHere", "Title" : "Mr" } > use dbatemp
switched to db dbatemp

> db.addUser("mohsin", "letmein"); { "user" : "mohsin", "readOnly" : false, "pwd" : "a3d585f806eedb44077cb71fd39763b7"
} > db.system.users.find(); { "_id" : ObjectId("4e4d102c38496fd5f156dbe1"), "user" : "mohsin", "readOnly" : false, "pwd" : "a3d585f806eedb44077cb71fd39763b7" } > db.auth("mohsin", "letmein") 1

Basic Comparison with an RDBMS

image

image

image

image

More available here

Managing from a GUI

JMongoBrowser

Advertisements

One Response to Supporting MongoDB

  1. gururaj says:

    Hi,

    We are looking for a trainer to deliver training on Mongo DB DBA
    Location: Chennai ( India)

    mail me : gururaj.k@sfjbs.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: