/  Technology   /  MongoDB how  work’s

MongoDB how  work’s

  

It’s time to take a closer look at how things actually happen behind the scenes. In MongoDB, the data is stored in databases, and as we are aware, the MongoDB server is a database server. In other words, MongoDB environment provides you with a server that you can start, and then use MongoDB to create multiple databases on that server as you wish. 

Because of its NoSQL database, the data is stored in the collections and documents of the system. The database, the collection, and the documents are therefore related to each other in the following way: 

  • There are collections in the MongoDB database just like there are tables in the MYSQL database. Multiple databases and collections can be created by you at the same time.
  • We now have documents inside the collection that are part of the collection. A document contains the data that we want to store in the MongoDB database, and it can contain multiple documents in a collection, and it is schema-less, which means that there is no requirement for one document to be similar to another.
  • It is the fields that are used to create the documents. There are two kinds of fields in a document, a key-value pair and a value pair, and they are just like columns in a relational database. It is possible to have the values of the fields to be of any of the BSON data types, such as doubles, strings, booleans, and so on.
  • There are documents in the format of BSON that are stored in the MongoDB that contain the data. BSON stands for Binary representation of JSON documents in this case. In other words, the backend process involves the MongoDB server converting JSON data into a binary format known as BSON, which is then stored and queried in a more efficient manner by the MongoDB server.
  • MongoDB allows you to store nested data within the documents that are stored in the database. By nesting data in this manner, you are able to create complex relationships between data and store them in the same document, making the process of working and retrieving data quicker and more efficient as compared to SQL. If you want to get the data from table 1 and table 2, you need to write complex joins in SQL in order to get the data. There is a maximum size limit of 16MB for the BSON document.

NOTE: A MongoDB server allows you to run multiple databases at the same time. 

How mongoDB is different from RDBMS ? 

The following are some of the major differences between MongoDB and the RDBMS that we use today:

MongoDBRDBMS
This is a non-relational database that is document-oriented and non-relational.In other words, it can be defined as a relational database.
A hierarchical data storage system is suitable for storing data in hierarchical structures.As a result, it is not suitable for the storage of hierarchical data.
The schema of the database is dynamic.There is a predefined schema for it.
As the name suggests, it is based on the CAP theorem (Consistency, Availability, and Partition tolerance).The focus of this course is on the ACID properties (Atomicity, Consistency, Isolation, and Durability).
Compared to RDBMS, it is much faster when it comes to performance.There is a difference in performance between it and MongoDB in terms of speed.

 

Leave a comment