Sunday 17 March 2013

MongoDB








Mongo is an open source nosql document-oriented database system which is very different from MySQL. The most considerable difference is that MySQL is written using SQL queries, while MongoDB is focused on BSON (Binary JSON) a binary object format similar to, but more expressive than JSON.

Instead of tables, a MongoDB database stores its data in collections, which are equivalent to RDBMS tables. A collection holds one or more documen, which corresponds to a record or a row in a relational database table, and each document has one or more fields, which corresponds to a column in a relational database table.

MongoDB will create collections and databases on their first use. We do not need to create the database or collection before inserting data.

MongoDB uses dynamic schemas. We can create collections without defining the structure and we also can change the structure of documents simply by adding new fields or by deleting existing ones.

Basic Commands of MongoDB:

* use mydb : Sets the context to mydb database. 
* mydb.mycol.insert( { "name" : "Mongo" } ) : Inserts document into the collection mycol.
* show.collections Shows the existing collections in database.
* mydb.mycol.find( ) : Shows the documents within a collection mycol.
* mydb.mycol.findOne( ) : Retrieves single document from the collection mycol.
* mydb.mycol.find( ).limits( n ) : Retrieves n document from the collection mycol.

Advantages of MongoDB

1Lightening fast.
2Auto sharding on it's way.
3Replication is very easy.
4You can perform rich queries, can create on the fly indexes with a single command.


Disadvantages of MongoDB

1Very unreliable.
2Indexes take up a lot of RAM.


Here you can get the Paint application using MongoDB




[Expecting Your Valuable Comments]
Thank You

No comments:

Post a Comment