Introduction to MongoDB

MongoDB is a NoSQL database which stores the data in form of key-value pairs. It is an Open Source, Document Database which provides high performance and scalability along with data modelling and data management of huge sets of data in an enterprise application.

MongoDB also provides the feature of Auto-Scaling. Since, MongoDB is a cross platform database and can be installed across different platforms like Windows, Linux etc.


What is Document based storage?

A Document is nothing but a data structure with name-value pairs like in JSON. It is very easy to map any custom Object of any programming language with a MongoDB Document. For example : Student object has attributes name, rollno and subjects, where subjects is a List.

Document for Student in MongoDB will be like :

{
	name : "Stduytonight",
	rollno : 1,
	subjects : ["C Language", "C++", "Core Java"]
}

We can see, Documents are actually JSON representation of custom Objects. Also, excessive JOINS can be avoided by saving data in form of Arrays and Documents(Embedded) inside a Document.


Brief History of MongoDB

MongoDB was developed by Eliot Horowitz and Dwight Merriman in the year 2007, when they experienced some scalability issues with the relational database while developing enterprise web applications at their company DoubleClick. According to Dwight Merriman, one of the developers of MongoDB, this name of the database was derived from the word humongous to support the idea of processing large amount of data.

In 2009, MongoDB was made as an open source project, while the company offered commercial support services. Many companies started using MongoDB for its amazing features. The New York Times newspaper used MongoDB to build a web based application to submit the photos. In 2013, the company was officially named to MongoDB Inc.


Key Features of MongoDB

Apart from most of the NoSQL default features, MongoDB does bring in some more, very important and useful features :

  1. MongoDB provides high performance. Input/Output operations are lesser than relational databases due to support of embedded documents(data models) and Select queries are also faster as Indexes in MongoDB supports faster queries.

    MongoDB performs less IO operations than relational DBMS

  2. MongoDB has a rich Query Language, supporting all the major CRUD operations. The Query Language also provides good Text Search and Aggregation features.
  3. Auto Replication feature of MongoDB leads to High Availability. It provides an automatic failover mechanism, as data is restored through backup(replica) copy if server fails.
  4. Sharding is a major feature of MongoDB. Horizontal Scalability is possible due to sharding.
  5. MongoDB supports multiple Storage Engines. When we save data in form of documents(NoSQL) or tables(RDBMS) who saves the data? It's the Storage Engine. Storage Engines manages how data is saved in memory and on disk.

Organizations that use MongoDB

Below are some of the big and notable organizations which are using MongoDB as database for most of their business applications.

  • Adobe
  • LinkedIn
  • McAfee
  • FourSquare
  • eBay
  • MetLife
  • SAP