MongoDB Features

In this tutorial you will learn about the MongoDB Features and its application with practical example.

MongoDB Features

Schema less :-

It uses dynamic and flexible schema, means you need not to specify schema beforehand. Instead, you can create fields on the fly.
Ad hoc queries :-

MongoDB provides a rich Query Language that is nearly as powerful as SQL. It supports aggregation function, random sample, range queries, regular expression searches and can include JavaScript functions as well. MongoDB queries supports Aggregation features.

Indexing :-

In MongoDB, indexing can be applied on any attribute/field, it improves the query performance.
Replication :-

In MongoDB, it is easy to replicate database across multiple distributed data centers, which results in increased availability.
Load balancing :-

MongoDB’s built-in auto-sharding feature allow it to scale horizontally by partitioning and spreading out the data across multiple servers, in order to achieve increased levels of scalability which was not possible with relational databases like MySQL.
File storage :- MongoDB can also be used as a file system, using load balancing and data replication features over multiple machines to store files.This function, called Grid File System, is included with MongoDB drivers. MongoDB provides functions for file handling and manipulation. The Grid File System divides a file into multiple parts, or chunks, and stores them as a separate document.
Aggregation :- MongoDB has built in support for batch processing of data and aggregation operations. MongoDB’s aggregation framework gives you following three ways to perform aggregation –

  • Aggregation pipeline
  • Map-reduce function
  • Single purpose aggregation methods

JavaScript on Server-side :- In MongoDB, JavaScript code can also be used with queries and aggregation functions such as MapReduce.
Capped collections :-MongoDB has built in support for fixed-size collections named as “Capped Collections”. Capped collections maintains the insertion order and, as the specified size is reached, it start working as a circular queue. Capped collection can be created using the db.createCollection command as following –

Here, collection is limited to 2 MB
Geospatial :-MongoDB provides the built in support to store the location specific data, which allows us to store x and y coordinates(longitude, latitude) within documents. MongoDB uses Geospatial indexes to find relevant documents near or within a radius of a set of coordinates. Geospatial indexes makes it easy, fast and accurate to find relevant data from specific locations.

Fast Writing :- MongoDB prefers high insert rate over transaction safety. In MongoDB, once you sent the write command, you need not to wait for actual write process.In MongoDB, the concept of journaling gives you better control on write performance with data durability.

Multiple Storage Engines :- MongoDB has built in support for multiple storage engines such as WiredTiger, and MMAPv1. In addition, MongoDB has pluggable storage engine API that enable third parties to develop storage engines compatible with MongoDB.

In this tutorial we have learn about the MongoDB Features and its application with practical example. I hope you will like this tutorial.