Follow



I often have the need to develop a system that implements dynamic search filters with a fast response time, allowing the user to view and select the filters. Such requirements are increasingly seen as an important feature in many platforms, mainly in e-commerce websites, and it is what makes it easier for the user to navigate the site.

Moreover, the nature of certain projects involve large amounts of data which require a Database Management System that is not only able to manage large amounts of data but also retrieve the data quickly and easily.

In these situations when a document database is more convenient than a relational database, one of my favorites among NoSQL is probably MongoDB.

MongoDB is a multi-platform document-oriented database, which is in concept very different to relational databases.

It’s true that one may feel a little lost when starting to use MongoDB: no tables, no rows and, more importantly, no SQL. Even so, MongoDB is a strong candidate to store our application’s data. Here is why:

One of the most important differences between MongoDB and relational databases such as SQLServer or MySQL is that when using MongoDB, one does not need to use a specific schema, this means that each entry or row may have a different schema, with attributes or “columns” that do not necessarily have to be repeated in other row, which allows to perform faster and more effective searches.

The most outstanding features and distinctive characteristics of MongoDB are its performance and rich yet straightforward Database Query. One might say it strikes a perfect balance between performance and functionality, integrating many of the query types we use in our favorite relational system without depriving performance.

Given the above, we can compare the two main database types:


Document-oriented DB Relational DB
Storage unit Documents Tables and rows
Purpose Fast information storage and retrieval Information storage, management, security and distribution
Structure Flexible, not relational Fixed, relational
Benefits
  • Flexible row model
  • Allow full-text indexing and carry out more performing queries
  • Provides tools to avoid wow duplication
  • Favors standardization as it is more understandable and functional
Drawbacks
  • Indexed take up too much RAM
  • Little documentation in the web
  • It’s harder to understand how data is related
  • If tables are not indexed it takes too long to retrieve the data

Where can be MongoDB used?

Although it is said that NoSQL databases have a reduced scope, MongoDB can be used in many projects we are developing nowadays. Due to its high performance, any application that needs to store semi-structured data can use MongoDB, being especially useful in environments requiring scalability. Replication and Sharding features enable us to scale horizontally with no major issues, which is increasingly required in the corporate sector.

In fact, MongoDB is becoming more popular in companies such as Foursquare, LinkedIn, Telefónica, Cisco, Bosch, eBay, Expedia, Forbes, IBM, Windows Azure, McAfee, etc.

Documents format and data query

Documents are stored in Binary JSON format, a modified version of JSON that enables faster data queries. Either way, we never see the format in which the data is actually stored and will always work with JSON documents when storing and retrieving data.

This is one advantage of working with a concise flexible framework, for both queries and store. JSON syntax is similar to other used in many programming languages and is, therefore, easily recognizable for developers regardless of the programming language they are used to.

To sum up, if you need a flexible, scalable, simple and, most important, high performance database that does not require a large structure, you will be more than happy using MongoDB.


Facundo Lavallen

About Facundo Lavallen

Facundo is a Software Engineer with more than 10 years of experience developing Web applications for some of the most important Fortune 500 companies

Nowadays Facundo works at the Engineering department of TISA, looking for implementing the latest technologies and frameworks to be used in future projects.

Beyond his technical knowledge and passion for the technology Facundo enjoys playing Ping-Pong, Soccer and Paddle.