MongoDB is a NoSQL File-based DBMS. In this, the data is stored in files at three levels: documents, collections, and DB’s. Let’s have a deeper dive into its features and benefits.
Key Features Of MongoDB
There are many key features of MongoDB that make it a preferred database when approaching modern web application developments.
1) Aggregation Framework
It provides an aggregation feature to use it efficiently. For batch processing of data and aggregation operations, MapReduce can be used. MapReduce is nothing but an associated implementation for processing and generating big data sets with the parallel, distributed algorithm on a cluster.
A MapReduce is a programming model composed of two procedures: Map() and Reduce().
- Map() procedure performs filtering and sorting
- Reduce() procedure performs a summary operation
2) MongoDB uses BSON format
One of the key features of MongoDB is that it uses BSON format. BSON is a JSON-like storage format. BSON stands for Binary JSON which is a binary-encoded serialization of JSON-like documents that MongoDB uses when storing documents in collections. It adds support for data types like Date and binary that aren’t supported in JSON. BSON format is the use of the _id field as the primary key. The value of the _id field will usually be a unique identifier type, named Objected, that is either generated by the application driver or by the MongoDB service (in case the application driver could not generate this).
Another advantage of using BSON format is that it enables MongoDB to internally index and map document properties and even nested documents. It is designed to be more efficient in size and speed, allowing MongoDB’s high read/write throughput.
3) MongoDB Sharding
The major and very common problem with a growing web application is scaling. To overcome this, MongoDB has come up with Sharding feature. It is one of the greatest key features of MongoDB. Sharding is a method for distributing data across multiple machines. It uses sharding to support deployments with very large data sets and high throughput operations. Sharding makes it possible to provide horizontal scalability. Horizontal scaling (referred to as sharding also) is a complicated process and is done using several machines or shards. Each shard holds a portion of the data and functions as a separate database. The collection of several shards together is what forms a single logical database. Thus, it helps in load balancing too. However, it is not a simple task since we need to properly divide the data between different machines and manage the read/write operations between them.
4) MongoDB Ad hoc queries
It supports field, range queries, regular expression searches. Queries can return specific fields of documents and also include user-defined JavaScript functions. It is able to support ad hoc queries by indexing BSON documents and using a unique query language.
5) MongoDB is Schema – Less
MongoDB is a schema-less database (written in C++) because of which is much more flexible than traditional database tables. The benefit is the lack of setup and the reduced friction with OOP. So, in order to save an object, you just have to serialize it to JSON and send it to MongoDB.
6) Capped Collections
MongoDB supports fixed-size collections called capped collections. This type of collection maintains insertion order. Once the specified size has been reached, it starts behaving like a circular queue.
7) MongoDB Indexing
Indexes are created to improve the performance of searches. The good thing is that any field in a MongoDB document can be indexed with primary and secondary indices. It enables the database engine to efficiently resolve queries which makes it one of the best key features of MongoDB. The database engine can use a predefined index, which maps documents fields and can tell the engine which documents are compatible with this query statement, hence improves performance.
8) File storage
MongoDB can be used as a file system with load balancing and data replication features over multiple machines for storing files. This function, called Grid File System, is included with MongoDB drivers which store files. MongoDB exposes functions for file manipulation and content to developers.
9) Replication
MongoDB provides a replication feature by distributing data across different machines. It can have one primary node and one or more secondary nodes. This typology is known as a replica set. A replica set is like master-slave replication. A master can perform Reads and Writes and a Slave copies data from the master and can only be used for reads or back up (not writes). Another robust feature of the MongoDB replica set is its automatic failover. When the old primary comes back online, it will rejoin the replica set as a secondary instance. Thus, MongoDB provides high availability. Replication is one of the major key features of MongoDB that make it production-ready.
10) MongoDB Management Service (MMS)
MMS is a powerful web tool that allows us to track our databases and our machines and also backing up our data. MMS also tracks hardware metrics for managing a MongoDB deployment. It shows performance in a rich web console to help you optimize your deployment. It also provides features of custom alerts which helps to discover issues before your MongoDB instance will be affected.
11) Distributed Transactions
It introduced multi-document ACID transactions in the release of MongoDB 4.0, providing a consistent view of data across replica sets and enforcing all-or-nothing execution to maintain data integrity. Combined with the power of the document model and its distributed systems architecture, developers can easily modernize legacy apps and build new transactional services. Distributed Transactions maintain an identical syntax to the transactions introduced in MongoDB 4.0. They are multi-statement and enforce snapshot isolation, making them familiar to any developer with prior transaction experience. The API and implementation are consistent whether executing transactions across documents, collections, and databases in a replica set, or across a sharded cluster. Full atomicity is maintained — if a transaction fails to commit on one shard, it will abort on all participant shards.
12) The Next Level in Enterprise-Grade Security
MongoDB 4.2’s implementation of Field Level Encryption is a comprehensive approach than column encryption used in legacy, relational databases. It is totally separated from the database, transparent to the server, and handled exclusively within the MongoDB drivers on the client. Most databases handle encryption on the server-side, which means data is still accessible to administrators who have access to the database instance itself, even if they have no client access privileges. Field Level Encryption changes that.
Advantages of Field-Level Encryption include:
- Automatic, transparent encryption: Application code can run unmodified for most database read and write operations.
- Separation of duties: System administrators who traditionally have access to operating systems, the database server, logs, and backups cannot read encrypted data unless explicitly given client access along with the keys necessary to decrypt the data.
- Regulatory Compliance They believe encryption for data at rest is table stakes today for people buying old tech that’s been retired. Some relational databases have encryption as a feature but it’s server-side. Field-level encryption is powerful in that customers can encrypt precisely the data necessary to protect end-user PII and since the encryption keys remain with the customer, MongoDB never has access to the encrypted data.
13) Full Control From a Single Kubernetes Plane
Users can now manage their MongoDB deployment from a single Kubernetes control plane.
To know more contact www.redcrix.com