What is MongoDB

What is MongoDB

Hello, I hope you are having an excellent day. In today’s article, we will talk about MongoDB, we will see the theory and for my next article, we will focus more on the practice using MongoDB on your console. If more, for now, let’s start.

First, we have to define MongoDB, According to the official website, it tells us: “MongoDB is a distributed database based on documents and general use that has been designed for developers of modern applications and the era of the cloud. It is a documentary database, which means that it stores data in the form of JSON documents. We believe that this is the most natural way of conceiving data; in front of the traditional model of rows and columns, this one is much more expressive and powerful.”, for more information consult its official page https://www.mongodb.com/

MongoDB is a NoSQL database, what does this mean? As its name says, this type of technology does not have the main functions of the classic model of relationships between entities existing in relational database management systems, being more specific, the main SQL query language is not used. What does this mean?. Unlike traditional relational databases, in most NoSQL systems, they do not implement rigid consistency mechanisms that ensure that any changes made to the distributed system are seen, at the same time, by all nodes and ensuring, also, the non-violation of possible data integrity restrictions or other defined rules. In its place and to obtain a better performance, the concept of “eventual consistency” is offered, in which the changes made “overtime” will be propagated to all nodes, so a query may not return the latest available data or provide inaccurate data, a problem is known as dirty or obsolete readings.

But MongoDB is a powerful database manager and at the same time too flexible, as we mentioned before it is a database that NoSql, therefore it is not necessary to carry a rigid scheme that has to be compulsorily fulfilled, so it uses a JSON style document system, the format would be something like this:

JSON is an object too powerful to share information between applications created by JavaScript, but despite its advantages for mongo it is not enough since the types of data that JSON handles are limited and at the time of reading it is much longer since it reads everything the entire object (including keys and values) to find the desired value, therefore MongoDB is obliged to use a slightly more powerful variant called BSON.

BSON is a binary representation of JSON, it only focuses on the names of the keys to obtain a desired value at the time of searches, therefore it is faster than JSON. BSON uses the same data types as JSON that are String, Numbers, Null, Arrays, Objects and Boolean and also uses the following types of data: ObjectID (It is a unique value), TimeStamp (It is a time value), Date, BinData and String (UTF 8).

These types of data make life easier for us when saving and consulting data. MongoDB is a powerful and scalable database, which can be used for any type of application. In order not to lengthen the article in the following one, we will see a little more of MongoDB in practice, we will see how we can do a CRUD, (Create, Read, Update and delete) from the mongo console, this article was a bit of theory for you to wake up a little interest in this type of database, I see them in the following article, see you later.