What is MongoDB?


MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling.

MongoDB is a powerful, flexible, and scalable data store. It combines the ability to scale out with many of the most useful features of relational databases, such as secondary indexes, range queries, and sorting.

MongoDB is also incredibly featureful: It has tons of useful features such as built-in support for MapReduce-style aggregation and geospatial indexes

 Document Database

A record in MongoDB is a document, which is a data structure composed of field and value pairs.

MongoDB documents are similar to JSON objects. The values of fields may include other documents, arrays, and arrays of documents.

The advantages of using documents are:

    - Documents (i.e. objects) correspond to native data types in many programming languages.
    - Embedded documents and arrays reduce need for expensive joins.
    - Dynamic schema supports fluent polymorphism.

Key Features

High Performance

MongoDB provides high performance data persistence. In particular,

        - Support for embedded data models reduces I/O activity on database system.
        - Indexes support faster queries and can include keys from embedded documents and arrays.

High Availability

To provide high availability, MongoDB's replication facility, called replica sets, provide:
            - automatic failover.
            - data redundancy.

A replica set  is a group of MongoDB servers that maintain the same data set, providing redundancy and increasing data availability.

Automatic Scaling

MongoDB provides horizontal scalability as part of its core functionality.

        - Automatic sharding distributes data across a cluster of machines.
        - Replica sets can provide eventually-consistent reads for low-latency high throughput deployments.

MongoDB is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. MongoDB works on concept of collection and document.

Database is a physical container for collections. Each database gets its own set of files on the file system. A single MongoDB server typically has multiple databases.


Collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists within a single database. Collections do not enforce a schema. Documents within a collection can have different fields. Typically, all documents in a collection are of similar or related purpose.


A document is a set of key-value pairs. Documents have dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection's documents may hold different types of data.

Below given table shows the relationship of RDBMS terminology with MongoDB

Table                      Collection
Table JoinEmbedded Documents
Primary Key
Primary Key (Default key _id provided by mongodb itself)

Related Post