What is MongoDB


is a NoSQL, document-oriented, open source data system.

What is MongoDB?

MongoDB is a document-oriented database. In other words, instead of saving the data in records, it saves the data in documents. These documents are stored in BSON, which is a binary representation of JSON.

One of the key differences with respect to the related database is that you do not have to follow a schema. Documents from the same collection or similar concept may have different schemes.

Features of MongoDB

Some of the features of MongoDB are as follows:

  • Ad hoc consultations. Supports field search, range queries, and regular expressions.
  • Indexing. Any field found in MongoDB document can be indexed, just as it is possible to make secondary indexes.
  • Replication. MongoDB supports the primary-secondary replication type. Each primary and secondary group is qualified as a replica set.
  • Load balancing. It allows you to scale both horizontally using the shard concept.
  • File storage. It can be used as a file system, leveraging MongoDB’s ability to load balance and replicate data across multiple servers. This functionality, called GridFS15 and included in the official distribution.
  • Aggregation. It provides an aggregation framework that allows you to perform operations similar to SQL ‘GROUP BY’. It is built as a pipeline in which the data goes through different stages in which this data is modified, aggregated, filtered and formatted until the desired result is obtained.
  • Server-side JavaScript execution. MongoDB can perform queries using JavaScript, having them sent directly to the database to be executed.

Where can MongoDB be used?

The Application of MongoDB, unlike NoSQL Databases, has a broad scope of application. It can be used in many projects today. We can say that it can be used in any application that needs to store semi-structured data.

MongoDB is especially useful in environments that require scalability. With its replication and sharding options, which are very simple to configure, we can get a system that scales horizontally without too many problems.

However, it can only guarantee atomic operations at the document level. If transactions are something indispensable in our development, we must think of another system.

There are also no JOINS. If we want to consult related data in more than two collections we have to make more than one query.

MongoDB has a framework for performing queries of this type called the Aggregation Framework. You can also use Map Reduce. But on the other hand it does not reach the power of a relational system. If we are going to need to exploit complex reports, we should think about using another system. Point that is modified and improved in each version.

¿Quieres suscribirte a nuestra Newsletter?

¡Mantente al día con noticias del sector!