MongoDB often confuses people because they don’t understand what its purpose is. MongoDB doesn’t have a singular purpose – it is good in many instances, and yes, it is bad in some situations too, but that is just how every piece of technology is. We have different languages and databases because no one technology can be the best fit for every situation. The main thing which makes MongoDB so great, especially when it comes to big data, is its approach towards data storage. MongoDB works so well in big data situations because it understands big data.
The Problem with Big Data
Big Data isn’t manually organized. If you are working with a limited dataset, it is possible to give it a structure for storage. You know what goes where and you can simply place it there. However, if you are dealing with billions of rows of data, you cannot give it structure. Another problem is that big data is often just captured data. The captured data is anything that the system was able to store and doesn’t really have any set structure. When you try relational databases, it gets horribly messy. You don’t know the relations of the data completely so how can you structure it in a way in which a relational database will be able to handle it?
Another big problem is the slow speed of relational databases. When trying to get information from billions of records and from different places, relational databases can take some serious time generating the results you want.
How MongoDB helps
MongoDB stores data in a JSON document format. This allows you to throw whatever data you want from it without worrying about the relations of the data. The fact that it is a JSON store also means that information can be retrieved very quickly. Things that would take minutes for relational databases to find can be found in MongoDB in mere seconds. Basically, in any situation where the data isn’t relational and needs to be processed quickly, MongoDB is the database you should be choosing. This is why in most big data workplaces, you will find MongoDB (or a similar database) being used instead of the databases we are used to.
When not to use MongoDB
There are some people who say that MongoDB isn’t good or quick. These people talk about how SQL is superior. These people are missing the point. MongoDB isn’t meant to replace SQL or any database which stores relational data. MongoDB is made for cases where the normal databases don’t work right. If you were to create a social network then MongoDB would be the wrong choice for you (even though many people claim social data isn’t relational, it does need relational properties to function properly). If the user whose data you are managing has to login first, then your data is a bit relational. Complaining that MongoDB doesn’t work everywhere is like saying a butter knife isn’t good at cutting onions – that’s not what it was designed to do anyway!