MongoDB Features

  • MongoDB is a document-oriented database, that makes the scaling very easier. It replaces the concept of "row" with more flexible "document".
  • Relational databases are very difficult to scale, the MongoDB scales easily and capable to store rich data structures.
  • In a relational database, first we need to create the structure before capturing data. But using mongodb, we can easily insert data whose structure can't be known in advance.
  • MongoDB uses the BSON binary format.
  • The key-value structure offer a flexible data model, dynamic modification of schema and allows to store and combine data of any structure.
  • It is well suited as a primary data storage for modern web applications.
  • It supports secondary indexes, allowing a variety of fast queries and full text indexing as well.
  • We can run complex aggregations from a simple code.
  • It is schema-less, no need to configure the database column with types.
  • It provides native drivers for all popular programming languages and frameworks.
  • It offers a range of tools for interacting with database, independent of the drivers.
  • Mongodb is not only limited to simple key-value operations. The developers can build advanced applications using aggregations, complex queries and secondary indexes.
  • Most of the applications are working on object oriented languages, and so developers want a database that better maps to objects. Mongodb fulfills this requirement.
  • To handle the failure of server outages, it provides Replica-set, which distribute data across machines for redundancy and handle server failure. It consists of one primary node and one or more secondary node.
  • MongoDB provides horizontal scale out for databases using a technique called Auto-Sharding. It distributes data across multiple partitions called shards.

MongoDB Terms

Let's know the terms used in document oriented database with an example -{ _id: ObjectID('8sf332f3dcefd644108961bb'),
title: 'MongoDb Features',
url: '',
author: 'etutorialspoit',
views: 2000,
tags: ['mongodb', 'nosql', 'document-based']

Collection - Collection in MongoDB is an analog of a table in a relational database. It is a group of documents. Each document in a collection can have different structures. A collection can contain up to 64 indexes.

> db.employee.insert({name:"Priska",dept:"IT",role:"developer"});
In the above example, 'employee' is a collection.


Document - A document is equivalent to a row in relational database and it is essentially a set of property names and their values. MongoDB stores data as documents in BSON.

The above document contains three key-value pairs.


ObjectId - Every document in MongoDB must have a unique id (_id key). ObjectId is a default type that automatically generates a unique id if not specified for _id.

"_id" : ObjectId(),
"key" : "value"


Key - The keys in a document are strings. It does not contain null character.

Value - The value can be simple or complex data types, such as strings, numbers, dates, array. It can also be other documents.

Indexing - MongoDB provides secondary indexes, which are implemented as B-trees and also provides unique, compound, full-text indexing capabilities as well.

Limitations of MongoDB

It is prescribed to run MongoDB on 64-bits machines. To run on 32-bits systems, you should have at least 4GB of memory.