What is Mongo DB ? and why it is getting more popularity?

What is Mongo DB ? and why it is getting more popularity?

What is Mongo DB?

Basically mongo DB is a JSON like structure database which provide us with the facility to use JSON objects to store data in our database.

Mongo DB is No SQL database. Wait but what that means?

Let first understand the SQL and NO SQL database.

In SQL we use relationships for data management. which is RDBMS relational database management system.

While in No SQL we use a non-relational, document-oriented database management system.

In the SQL database, we store our data in table format.

In No SQL we Store data in the form of a document.

Now we know the difference between SQL and NO SQL database. Let's understand how mongo DB work as no SQL database.

We use SQL to query our relational database but mongo DB uses BSON to query the database.

But what is BSON?🤔

Many of us have used JSON a number of times and we know JSON parsing is slow and to overcome this BSON is invented that is Binary JSON. BSON’s binary structure encodes type and length information, which allows it to be parsed much more quickly. Which makes the mongo DB faster.

MongoDB stores data in BSON format both internally, and over the network, but that doesn’t mean you can’t think of MongoDB as a JSON database. Anything you can represent in JSON can be natively stored in MongoDB, and retrieved just as easily in JSON.

For example: Let say we want to store students information in the database.

In the relational database

No.Nameclassroll no.
1.SachinIT.5

In mongo DB

[{
"_id":1,
"Name":"Sachin",
"Class":"IT",
"Roll no.":5
},
{
// Data
}]

Suppose we want to add another field or column to our data that is active. Now in the relational database, we need to perform some column add operation and all. but in mongo, we can do it easily like this.

[{
"_id":1,
"Name":"Sachin",
"Class":"IT",
"Roll no.":5,
"Active":true or false // Boolean value
},
{
// Data
}]

In SQL :

  1. Table
  2. Row
  3. Column

In No SQL:

  1. Collection
  2. Document
  3. Fields

Because of its simplicity and flexibility, Mongo DB is getting more and more popular.

Whether it MEAN or MERN stack there M means Mongo DB.

Conclusion

If you want to get a taste of the No SQL database then I recommend you to start with Mongo DB. Or if you are working on some Project and want faster responses then use Mongo DB.

And that’s it for this topic. Thank you for reading.

Connect with me

LinkedIn | Twitter

Did you find this article valuable?

Support Sachin Chaurasiya by becoming a sponsor. Any amount is appreciated!