NoSQL Database Models
Software Engineer path · lesson 60 of 99See one e-commerce order reshaped as a document, a key-value pair, and a wide-column row — and how each NoSQL family trades consistency for availability differently.
{
"orderId": "ord_8842",
"customer": {
"name": "Priya Shah",
"email": "priya@example.com"
},
"items": [
{
"sku": "LP-2200",
"qty": 1,
"price": 1299
},
{
"sku": "BK-0087",
"qty": 2,
"price": 24
}
],
"shippingAddress": {
"city": "Austin",
"state": "TX",
"zip": "78701"
},
"status": "shipped",
"createdAt": "2024-03-01T14:22:00Z"
}Key insight
The whole order — items array, nested address, everything — lives in one document. No joins to reconstruct it, and the next order can have extra fields (a coupon code, a gift note) without altering every other document's shape.
Which NoSQL family?
Sort each description into the data model it fits.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
Document
Drop items hereKey-value
Drop items hereWide-column
Drop items hereTest your knowledge
A document database stores a record as…
The short version
A document store keeps the whole order as one self-contained folder. A key-value store is a coat-check ticket — hand over the number, get the blob back, no peeking inside. A wide-column store is a spreadsheet where each customer gets their own sparse row of time-stamped columns.
In more depth
NoSQL Database Models
NoSQL isn't one thing — it's a family of models, each optimized for a specific access pattern by relaxing something a relational database guarantees by default.
Document stores (MongoDB) keep whole, possibly nested, possibly schema-varying records together — good when you read/write an entity as a unit.
Key-value stores (DynamoDB, Redis) are pure O(1) lookup by key with no query language — the fastest, simplest model, ideal for caching and session data.
Wide-column stores (Cassandra) partition rows by a key and cluster them by a sort key (often time), making "give me this partition's recent rows" extremely fast — the backbone of time-series and event-log workloads.
Each trades cross-entity consistency or joinability for that speed, landing differently on the CAP triangle by default.
Interview Questions
References & Further Reading
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required