Types of NoSQL Databases: Choose the Right Model with Worked Examples
Learn to identify the four main NoSQL models from their access patterns, trace their exact outputs, and solve a numerical workload-routing example.
KnowledgeGate Team
Exam prep & CS education

Key-value, document, wide-column and graph databases are often memorised as four definitions. The harder questions disguise them as access patterns and ask which model fits. Model choice turns on whether the workload needs exact-key session lookup, whole-order retrieval, ordered user-event queries or multi-hop course recommendations. No single family is universally faster or better for every workload.
What the four NoSQL types actually classify
NoSQL is an umbrella for non-relational data models, often taught as "not only SQL". The taxonomy classifies systems by primary model and access path, not brand, size or guaranteed consistency. Products may support multiple models, so the families are learning aids, not product boundaries.
Sharding, replication, quorum settings and CAP trade-offs belong in Characteristics of NoSQL. Model selection instead starts with the data shape, access path and required output.
Type | Primary retrieval | Question it answers |
|---|---|---|
Key-value | An opaque or semi-opaque value by exact key | What value has this key? |
Document | A queryable, self-contained record | What fields belong to this aggregate? |
Wide-column | Sparse columns around partition and clustering keys | Which ordered rows belong to this partition? |
Graph | Entities plus relationships for traversal | How are these entities connected? |
The CS Fundamentals category places this topic in its broader DBMS route. Start with queries and updates, then consider integrity, scale and operations.
Key-value stores: exact-key access with a simple shape
Consider the classroom entry session:9AF -> {user_id:"U17", page:"/checkout", retry_count:2, ttl_seconds:1800}. The command GET session:9AF returns that whole value. After another retry, the application changes retry_count:2 -> 3. It already knows the key, so it needs neither relationship traversal nor a search across several fields.
This shape suits session state, cache entries and preference blobs with stable lookup keys. If the main question becomes "find every session whose retry_count >= 3", a pure key lookup cannot answer it. The system needs another index, a scan or a different model. Some key-value products do support indexes and structured values.
A key-value entry can therefore contain JSON-like data without becoming document-oriented. The decisive clue is whether fields inside the value are first-class query targets.
Document databases: retrieve and evolve a complete aggregate
Store the order as O501={user_id:"U17", items:[{sku:"P10", qty:2},{sku:"P22", qty:1}], status:"packed", delivery:{city:"Pune"}}. The nested array contains 2 + 1 = 3 total units. A lookup by _id="O501" returns the order, items and delivery block together. An index on status can support a query for packed orders.
Now add O502={user_id:"U42", items:[{sku:"P22", qty:4}], status:"new", coupon_code:"WELCOME"}. O501 has delivery, while O502 has coupon_code. This structural flexibility does not mean "no schema" or "no rules". The application or database still needs to validate fields such as qty and status. For example, quantity should remain positive and status should come from an allowed set.
Normalised tables offer a different retrieval path, covered in SQL Queries and Joins in DBMS, while Normalization in DBMS from 1NF to BCNF explains the update-integrity trade-off. Embedding favours aggregate reads, but duplicated data can make updates fan out. Neither design is automatically superior.
Wide-column databases: design the row around partition and order
For activity data, use partition key user_id="U17" and clustering key event_time descending. The three classroom rows are:
event_time | page | action |
|---|---|---|
10:02 | /dbms | view |
10:05 | /nosql | view |
10:09 | /quiz | submit |
The query "latest two events for U17" orders within the partition and returns (10:09, /quiz, submit) followed by (10:05, /nosql, view). The partition gathers one user's events, and the clustering key makes the required order explicit.
A query for every submit event across all users is not automatically efficient merely because an action column exists. It needs a supporting access path. Also, "wide-column" does not mean a spreadsheet or an analytical columnar file format. B+ Trees and Database Indexing provides a useful contrast for ordered index reasoning, without implying that every wide-column system uses or excludes one index structure.
Graph databases: make the relationship queryable
Create nodes User U17, User U42, Course C10="DBMS" and Course C22="Networks". Add edges (U17)-[:ENROLLED_IN]->(C10), (U42)-[:ENROLLED_IN]->(C10) and (U42)-[:ENROLLED_IN]->(C22). Follow the exact three-edge path U17 -> C10 <- U42 -> C22. After excluding C10 because U17 already has it, the classroom recommendation is C22.
This result depends on a variable relationship pattern, which is the graph clue. If the only query were GET user:U17, a graph would add little by itself. In the other direction, repeatedly materialising multi-hop joins or adjacency lists in application code can obscure a traversal-centred problem. Graph databases do not remove every constraint, join or indexing concern.
Connected data alone is not enough. Choose a graph when relationships and changing traversal depth are central to the query, not simply because the data can be drawn as a network.

Worked example: route 10,000 operations to the primary model
Suppose an illustrative one-minute workload contains 10,000 operations: 70% exact session-token lookups, 20% whole-order reads by order ID, 7% requests for a user's latest events, and 3% multi-hop course recommendations. Convert each share into a count:
Key-value:
10,000 x 0.70 = 7,000operations.Document:
10,000 x 0.20 = 2,000operations.Wide-column:
10,000 x 0.07 = 700operations.Graph:
10,000 x 0.03 = 300operations.
The checksum is 7,000 + 2,000 + 700 + 300 = 10,000.
The 7,000 known-token lookups fit the key-value path returning session:9AF. The 2,000 aggregate reads fit documents returning O501 with 3 units. The 700 time-ordered reads fit the U17 wide-column partition returning 10:09 and then 10:05. The 300 traversals fit the graph path whose result is C22.
These four routes classify primary access patterns. A production team does not need to operate four databases merely because its workload contains all four paths. The team must weigh operational complexity, overlapping data, consistency needs and existing capabilities before adopting polyglot persistence.
As a check, raise the workload to 12,000 operations per minute with the same mix. The counts become 12,000 x 0.70 = 8,400, 12,000 x 0.20 = 2,400, 12,000 x 0.07 = 840 and 12,000 x 0.03 = 360. They reconcile as 8,400 + 2,400 + 840 + 360 = 12,000.

How exams test the types and the traps that cost marks
Durable question forms include matching a workload to a model, finding the query result from a supplied representation, separating document embedding from key-value lookup, choosing partition and clustering keys for an ordered query, following a graph path, and calculating workload shares.
Try this answer-first check. P is GET session:9AF. Q fetches O501 and its nested items. R asks for U17's latest two events. S follows U17 -> C10 <- U42 -> C22. The answer is P-key-value, Q-document, R-wide-column, S-graph. The numerical checks are equally direct: O501 has 3 units, U17's latest pages are /quiz and then /nosql, and 7% of 10,000 = 700.
Avoid the classic traps. NoSQL is not automatically schema-free, transaction-free, join-free or faster. Wide-column is not a spreadsheet. A JSON value does not automatically make a store a document database. Graph is not required for every connected dataset, and one product can be multi-model.
The short version and the next deliberate step
Use this recall chain: known key suggests key-value; self-contained aggregate suggests document; partitioned, ordered row access suggests wide-column; relationship traversal suggests graph. Reproduce the 10,000-operation split and explain each exact output before attempting practice questions. Test your choice by naming both the primary access path and the expected result, not merely a product family.
For a practical document-database follow-up, use the Node.js, Express.js and MongoDB course.
Keep learning
Data Link Layer Access Control: Choose the Right MAC Method and Solve Mixed Numericals
Learn to classify MAC methods, build one timing model, and solve collision windows, contention probabilities and controlled-access efficiency without mixing assumptions.
React State Management Options: Choose the Right Tool with Runnable Examples
Follow one cart and inventory example to decide where state belongs, trace each update, and choose the smallest React state tool that fits.
C++ deque, list and forward_list: Choose the Right Non-Vector Container
Use one controlled sequence-editing workload to compare deque, list and forward_list. See where search cost, iterator validity and memory locality change the decision.
C++ Arrays vs std::array vs std::span: Choose the Right Interface
Run the same five integers through raw-array, std::array and std::span interfaces, then choose from their ownership, size and lifetime contracts.





