About MongoDB

MongoDB is a fast becoming a major player in the database arena, but its not the traditional database like Oracle or SQL Server that you might think of. To fully understand the differences, you need to change how you think about databases.

A traditional Relational Database has all its data set up in tables, and each of these tables have rows and columns. Its very linear in that respect and requires joins between the tables for the data to be relational. All DBAs will be familiar with the concept CRUD using SQL Language and this is how RDBMSs work. The purpose being to reduce duplicate data within the database engine. By reducing the duplicate data, we save on storage.

MongoDB has a different data model where the database has collections of documents written in JSON. The way this is different to RDBMS is that one document contains all the information that an RDBMS may need to store in multiple tables. For instance, lets say we have a traditional RDBMS with Employees and their respective Addresses. There will probably have to be a unique key or ID that joins the two tables so that any particular employee could be matched to their address using some SQL. In MongoDB, this need to join and filter is much easier and in some cases not even needed. We could replace our example above with one collection called employees and each document in the collection is dedicated to each employee and all the information about them. All you would need then is a simple find command and just a name. No joins necessary. This is a key advantage for MongoDB as this type of operation requires less processing power. However, it does require a knowledge of JSON for the end user to be able to use the database. As storage costs decrease and disk speeds increase the need to scrimp on storage is no longer an issue for many customers.

So why should we consider changing? Well there are many answers to this, but they mainly all fall under one reason which is Overhead. Big data is an industry buzz word these days and there are many ways that a traditional RDBMS could cope with big data, but not without a considerable amount of overhead. Operating costs, CPU, RAM can bottleneck even the best structured RDBMS if the data is too big to handle and in some cases you can end up patching up hardware at a considerable cost. The reality is, changing your data model may be a better solution.

Where MongoDB comes in is in its simplicity to store data in documents which in turn makes them easier to find and less resource intensive. This mean that costs can be kept down and used for scalability instead of patching performance losses. MongoDBs ability to scale out its documents to secondary servers and sharded clusters gives it a much more data powerful (and accountant friendly) position in the market compared to traditional databases.

For more information, please contact us

Graham Barnes