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

mongo vision secrets

Table of Contents

What is mongo DB?

Basically mongo DB is 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. That is RDBMS relational database management system.

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

In 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 database.

But what is BSON?🤔

Many of us have used JSON 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 into database.

In the relational database

No. Name class roll no.
1. Sachin IT. 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 popularity.

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

Conclusion

If you want to get a taste of 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.

Comment down if you have any questions. if you like my post then Buy me a coffee.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top