How To Decide If MongoDB Is Right For You
Yes, MongoDB is a NoSQL database. This word can be pretty confusing. I’ll try to analyze the most common ideas with a focus on how this applies to MongoDB.
In traditional SQL databases, data is arranged in the form of tables and rows. Each row has a fixed number of columns that can only store data of a specific type (e.g., integer, text, datetime). This defines the schema of your data.
In MongoDB, data is stored in the form of BSON objects organized into collections. Data is usually handled in the form of JSON objects. This makes mapping objects into the database a simple task, normally eliminating anything similar to an object-relational mapping.
This means you don’t have to tell the database the structure of your data and the primitive types to be used before being able to manage it.
This also means you can mix documents that have different structures in the same collection of data.
One of the great benefits is schema migrations become easier (most of the adjustments to the database are transparent and automatic). Rollback is unlikely to cause problems. Another advantage is dynamically extending existing data models with custom attributes at run time is straightforward.
This means you don’t have to always create a relation between two documents to handle aggregated data structures.