Why? Why do you need MongoDB?
In applications, you can store data using a relational database. The relational database already gives you the power to create complex relationships between data. Instead, you use a non-relational database. Why? Why do
In applications, you can store data using a relational database.
The relational database already gives you the power to create complex relationships between data. Instead, you use a non-relational database.
Why? Why do you need MongoDB?
And if your argument is that MongoDB is a simple-to-use NoSQL database, so I prefer MongoDB, then actually, you don't understand the actual use case of MongoDB.
So, the use case starts when you build a social media application, a quick-commerce application, or an application where the attributes of a field are not fixed.
In this type of application, each product has different attributes, and for that, in a relational database, you need to create many optional fields so the table supports different types of product data.
This approach works, but after a certain level, it requires a heavily normalized design that supports all the products at a higher scale. This becomes more complex for querying and planning the database.
Whereas MongoDB has superpowers.
Because it uses documents to store data instead of records.
But what is a document?
Unlike relational databases, where all the details of a specific person or product are stored in a record, MongoDB stores information in documents in the form of a field-value structure. This gives you the ability to add any number of fields or unique fields to a document.
And the group of these documents is called a collection. A collection has different documents with different fields.
The problem that we face in relational databases is solved by this collection and document approach provided by MongoDB.
Now, this is one ability of MongoDB, and it has many other abilities.
Tell me in the comment section.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.