Introduction to mongoDB

Overview of mongoDB

  • It is an open-source document database and leading NoSQL database.
  • It is written in C++.
  • It is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability.
  • It works on concept of database, collection and document.
    • Database:
      It is physical container for collections.
      A single mongoDB server might have multiple databases.
    • Collection:
      It represents a group of mongoDB documents.
      It is equivalent to RDBMS table.
      It exists within a single database.
    • Document:
      It is a set of key-value pairs

RDBMS                                                       MongoDB
Database                                                    Database
Table                                                           Collection
Tuple/Row                                                  Document
column                                                        Field
Table Join                                                    Embedded Documents
Primary Key                                                Primary Key (Default key _id provided by mongodb itself)

Note: Primary Key _id (12 bytes hexadecimal number) = Current timestamp(4 bytes) + Machine ID (3 bytes) + Process ID for MongoDB server (2 bytes) + incremental value (3 bytes)

Advantages of mongoDB :

  • It is a document database in which one collection holds different documents. Number of fields, content and size of the document can differ from one document to another.
  • It has a clear single object structure.
  • It doesn’t have complex joins.
  • It supports dynamic queries on documents using a document-based query language that’s nearly as powerful as SQL.
  • It is easy to scale.
  • In mongoDB Conversion/mapping of application objects to database objects not needed.
  • It used internal memory for storing the working set, enabling faster access of data.

Use of mongoDB:

  • It stored data in the form of JSON style documents.
  • It can put index on any attribute.
  • It has replication and high availability.
  • It has auto-sharding.
  • It has Rich queries.
  • It is fast in-place updates.

MongoDB is used basically in the following conditions:

  • Big Data.
  • Content Management and Delivery.
  • Mobile and Social Infrastructure.
  • User Data Management.
  • Data Hub.

MongoDB supports following datatype:

String, Integer, Boolean, Double, Min/ Max keys ?,  Arrays, Object, Null, Symbol, Date, Object ID, Binary data, Code, Regular expression


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s