Document database
A document database stores data as documents, usually JSON-like objects grouped into collections.
The core idea is that related data can live together in one document instead of being split across many normalized tables.
Example
{
"id": "user_1",
"email": "sargon@example.com",
"profile": {
"name": "Sargon",
"city": "Tokyo"
}
}
The document can contain nested fields and arrays.
What it is good for
Document databases are useful when the application works with:
- flexible schemas,
- nested objects,
- content-like records,
- rapidly changing product data,
- reads that usually fetch a whole object at once.
Tradeoff
They reduce friction when the shape of data changes, but relationships, cross-document consistency, and complex joins can become harder than in a relational database.