DEV Community

Cover image for Why MongoDB???
Afolayan Ademola Segun
Afolayan Ademola Segun

Posted on

Why MongoDB???

MongoDB is a Document database with the scalability and flexibility that you want
with the querying indexing that you need.
Scalability is the capacity to be changed in size or scale while
Flexibility is the quality of being modified easily without being broken.

Key MongoDB Features
Document Based: MongoDB stores data in documents (field-value pair data structures, No-SQL) instead of rows and column styles in traditional database in No-SQL pronounced (NO Sequel Data abase)
Scalability: It is very easy to distribute data across multiple machines as your users and amount of data grows. so whatever you do MongoDb gives you the room for you to grow.

Flexibility: There is no need to define a documents data schema before filling it with data meaning each documents can have a different number and types of field, and we can also change this fields all the time. And all this is really inline with some real life business situation and therefore it proves really useful]

Performance: Thanks to embedded data models. indexing, shading(divining a larger part into smaller unit), flexible documents, native duplication
MongoDB has proven to be a very performance database.

Open Source: MongoDB is a Free and open source database published under the SSPL license MongoDB is probably the most used Database with Node.js

BSON : It is the data format for MongoDB, it is used for data storage. like JSON but typed. So MongoDB document are typed. In relational Each field is called a column. It is arrange in table structures.
Another interesting feature in MongoDB is the concept of Embedded Documents. which is again something not present in relational database.
It is also called De-normalizing. Including related data into a single document. This allows for quicker access and easier data models (its not always the best solution though)
The advantage is that it allow us to read all the data at once
In Relational Database it is not possible to embed data, so you have to create a whole new table for the data and then link with some unique key from the field.

Finally the Maximum size for each Document in BSON is 60mb but this might increase in the future. and then each Documents have a unique ID once which act as a primary key to the document. It is automatically generated once you create a BSON documents. and so we don't have to worry about it.
With this understanding that you have of MongoDB, I believe you will start finding interesting to work with it and if you are SQL fan, yoop It doesn't take anything away to try different stuffs. Try MongoDB; you will love it!!!

MongoDB Document structure in picture.

Discussion (0)