MongoDB key features

Few days ago I had to work on a project where I need to implement a noSQL database, MongoDB. While working on it I find out some interesting points on it. I think these are the main features for which people are using mongoDB every now then. So let's check out those points in brief,

Load balancing:

MongoDB uses sharding to handle the load on it which can be enabled automatically. Sharding is an approach to scalability which separates your data across multiple servers. An inexperienced execution can put all of the data handling for the users. But it’s sharding capabilities far exceed such a simple problem.


For batch processing of data and aggregation operations we can use MapReduce. It's a pattern which has gain large popularity, and we can use of it anywhere like, C#, Python, Ruby and many more. We can use MapReduce to parallelize, allow huge data for processing over lots of cores/machines. Besides compared with SQL, MapReduce code is much more fancy.

Capped collections:

MongoDB supports fixed-size collections called capped collections. To create a capped collection we can use the db.createCollection command and marked it as capped:

//limit our capped collection to 2 megabyte

b.createCollection(’logs’, {capped: true, size: 2097152})

When this collection reaches 2MB limit, old documents are automatically removed from the DB. It has many properties. Like, user can update a document but it will not grow. Besides user doesn't need to add an extra index to receive time-based sorting.


Like relational database replication mongoDB replications works in same way. A single master server receives the writes and sync with one or more slave servers. If the master goes down then a slave can act as the new master.
You can change the control wheather the reads will be from slaves or master. And from this decision it will help to distribute the loads.


Support for geospatial indexes is one of the best features of MongoDB, which allows users to store x and y coordinates within documents. To find the documents which are $within a radius or $near a set of coordinates.


Another nice feature is schema-less which is much more flexible than traditional database tables. The benefit is the lack of setup and the reduced friction with OOP. So to save an object you have to serialize it to JSON and send it to MongoDB. There is no need for type mapping.

Fast Writing:

There are several aspects for MongoDB where it writes fast.Like, you can send a command to write and it can return without waiting for actual write process. Another part can be,the enhancements of journaling in 2.0, you can control the write command with for data durability. These settings can give you a huge control on write performance.

comments powered by Disqus