There are strong features set of MongoDB and it can be used for 13 reasons which are for: High scalability, High Availability, Schema free, Indexing, Aggregation Framework, Ad-hoc query, File Storage, BSON format, Capped Collection, Strong Active community, Commercial & Community support, Support of client Drivers, and Admin utility tools.
1. Features of MongoDB
These are the 13 reasons of using mongoDB. Following are the features in MongoDB and it can be used for all type of applications for all domain types of application.
- High scalability by Sharding
- High Availability by Replication
- Schema free
- Indexing – secondary indexing
- Aggregation Framework
- Ad-hoc query
- File Storage
- BSON format
- Capped Collection
- Strong Active community
- Commercial & Community support
- Support of client Drivers
- Admin utility tools
2. MongoDB features: High scalability by Sharding
First of all, understand the concept of Sharding. Sharding is partitioning of data and placing it on multiple nodes/machines in such a way so that order of the data is preserved and accept read and write request. NoSQL database such as MongoDB uses sharding for horizontal scaling or you can say for scale-out your MongoDB database.
Vertical scaling means adding more resources (CPU, RAM, disk etc) to the existing machine while horizontal scaling means adding more machines to handle the more data either for ‘size of data’ or for ‘volume of data’. From the DBEngine implementation point of view, Vertical scaling is easy simply adding data but from DBA ( who manages Data) that easy to implement, on the other hand, horizontal scaling is easy to implement. Horizontal scaling database examples: MongoDB, Cassandra etc. Because of this feature NoSQL can handle a huge amount of data, as the data grows NoSQL scale itself to handle that data in an efficient manner.
3.MongoDB features: High Availability by Replication
Auto replication feature in MongoDB makes it highly available because in case of any node failed, still replica set will be available. Usually, we make a replica set of MongoDB with 3 nodes, and in case of one node goes down, the replica set will be available with 2 nodes to accept for reading and writing.
4. MongoDB features: Schema free
Schema free is one of the most important features of MongoDB, it does not have restrictions on the schema of the database, however, you can add restriction or validation on it, if you want but that is not preferable. Just because of dynamic schema it gains popularity. It means developers love to use of schemaless structure, it means, in the first document you can add 2 columns,s and in the second document you can add 5 columns/keys. This gives you the flexibility to change your data in schema without modifying any of your existing data without DBA involvement.
A Schema-less database means one collection can hold different types of documents in it. Or in other words, in the MongoDB database, a single collection can hold multiple documents and these documents may consist of different numbers of fields, content, and size. It is not necessary that one document is similar to another document like in the relational databases. Due to this cool feature, MongoDB provides great flexibility to databases.
4.MongoDB features: Indexing – secondary indexing
Secondary indexing is one of the great features which MongoDB provides us. we can add the data in JSON structure and later point in time we can get a request. We need a secondary index on a particular key you can make an index on it, especially since the size of the data is very huge.
Indexing helps:
- to get the response faster
- to reduce the no of IOPS on disk i.e. collection scan
- utilize the resource of server to optimize the throughput
5.MongoDB features: Aggregation Framework
MongoDB does not support join directly but it support via aggregation framework. In any database aggregation is costly operation and so in MongoDB too. It allows to perform operations on the grouped data and get a single result or computed result. It is similar to the SQL GROUP BY clause. It provides three different aggregations e.g.:
- aggregation pipeline
- map-reduce function, and
- single-purpose aggregation methods
6.MongoDB features: Ad-hoc Query
Ad-hoc query is the query which is not known while designing or structuring the database. MongoDB provides ad-hoc query support which makes it so special to developer or admin of MongoDB.
The biggest advantage of MongoDB over other databases is its performance under pressure, especially when handling ad-hoc queries on data that are usually updated in real-time. MongoDB can retrieve specific fields, ranges, locations, values, and even respond well to regular expression queries.
7. File Storage
MongoDB supports all types of file storage, whether it is big or small. if document size is up to 16 mb keep data as byte or byte[] in the normal document. if the file size is greater than 16 MB then keep data in GridFS (Grid File Storage). GridFS has the capability to store files even greater than its document size limit of 16MB.
Storing files in MongoDB is more secure than storing files in a normal folder. you can store any secure document or any document like pdf, word, image, video etc.
8. BSON Format
MongoDB stores all documents as BSON, which is just a binary encoding of the good old JSON format. When storing JSON data in MongoDB it stores as BSON (Binary JSON). when it traverses the data over the network then it traverses in BSON (Binary JSON). JSON has UTF-8 encoding while BSON has binary encoding. BSON is readable by machine only while JSON is readable by Human and machine both.
9. Capped Collection
Capped collections are fixed-size collections that support high-throughput operations that insert and retrieve documents based on insertion order. Capped collections work in a way similar to circular buffers: once a collection fills its allocated space, it makes room for new documents by overwriting the oldest documents in the collection. It means it replaces a new one document with an older one if the document is full.
we have to create the size of the collection and tell the MongoDB engine, hey MongoDB engine this is my capped collection.
10. Strong Active community
There is a large ecosystem of users of MongoDB. initially, it was developed for log only but at later point in time it gain momentum and being used by all types of applications and all types of companies. There are so many banking and a financial system where MongoDB used extensively.
11. Commercial and Community support
MongoDB has commercial support too along with community support. There are so many companies providing their platform to use MongoDB as SaaS (Software as a Service), even MongoDB too offers this type of offering to ease out of the use.
MongoDB has a community edition of the software of the MongoDB database. It means a user of the MongoDB does not have to pay a single penny on subscription or licensing fee for deploying MongoDB community edition database.
12. Support of client drivers
MongoDB provides drivers of almost all the programming languages to connect to MongoDB to pull the data or push the data.
You can start using MongoDB with your own preferred language. The list on official site as: MongoDB https://docs.mongodb.com/drivers/
13. Admin Utilities tools
There are a lot of MongoDB monitoring utility tools for different admin jobs which is absolutely free. the few name as: mongodump for taking a dump, mongorestore for restoring of BSON data taken a dump on another machine or same machine. mongoexport and mongoimport for exporting and importing of data in different formats.
14. Video of this post: 13 Reasons of Using mongoDB
13 Reasons for using MongoDB Part-1
13 Reasons for using MongoDB Part-2
You reach here, it means you like this post. Please share this post and write you comment to encourage me to post like this. Happy Learning 🙂
Hello friends, how is all, and what you desire to say concerning this article, in my view its actually remarkable in favor of me.