What are the different types of NoSQL databases?
EasyConceptNoSQL, Replication & Sharding
Answer
NoSQL databases are grouped into four main families according to their data model.
- Key-value stores (Redis, Amazon DynamoDB): each value is looked up by a unique key, like a giant hash map. Used for caching, sessions and counters.
- Document stores (MongoDB, Couchbase): each record is a JSON-like document with nested fields, and documents in one collection can differ. Used for product catalogues and user profiles.
- Wide-column stores (Apache Cassandra, HBase): rows are grouped into column families, each row can have different columns, and the design handles very high write volumes across many servers. Used for time-series data and messaging.
- Graph databases (Neo4j): data is stored as nodes and edges, which makes relationship queries fast. Used for social networks and recommendations.
Example: One shopping cart in each model:
Key-value: "cart:42" -> "[pen, book]"
Document: { "user": 42, "items": [{ "sku": "pen", "qty": 2 }] }
Wide-column: row 42 -> pen: 2, book: 1
Graph: (User 42) -[ADDED]-> (Pen)
More in NoSQL, Replication & Sharding
| # | Problem | Platform | Difficulty | Open | 1st1st Visit | 2nd2nd Visit | RevRevise |
|---|---|---|---|---|---|---|---|
| 1 | What is the difference between SQL and NoSQL databases? | Concept | Easy | Read the answer to What is the difference between SQL and NoSQL databases? | |||
| 2 | What are the different types of NoSQL databases? | Concept | Easy | Read the answer to What are the different types of NoSQL databases? | |||
| 3 | What is the CAP theorem? | Concept | Medium | Read the answer to What is the CAP theorem? | |||
| 4 | What is database replication, and what are its types? | Concept | Medium | Read the answer to What is database replication, and what are its types? | |||
| 5 | What is sharding, and how is it different from partitioning? | Concept | Medium | Read the answer to What is sharding, and how is it different from partitioning? |