🗃️Document Database
Also known as Document Store, Document-Oriented Database
A NoSQL database that keeps each record as one document. It looks a lot like JSON.
Think of it like
Think of it like a folder of filled-in forms. Each form holds all the facts on one thing.
Example
Lucy's shop saves each order as one document, with its items and address inside. Showing an order is one read, with no joins.
Why it matters
When you use a record as a whole, keep it in one document. It is simple and fast.
Definition
Example code
json
{
"_id": 1042,
"customer": "Lucy",
"items": [
{ "name": "Mug", "qty": 2 },
{ "name": "Tea", "qty": 1 }
]
}Common mistake
Key takeaways
- 1One record, one document. Written like JSON.
- 2Nested parts. Lists live inside the record.
- 3Fields can differ. No fixed schema.