5 min read
•Question 24 of 27easyWhat are different types of NoSQL databases?
Understanding NoSQL database categories.
What You'll Learn
- NoSQL categories
- When to use each type
- Popular databases
NoSQL Categories
1. Document Databases
code.jsJavaScript
// Stores JSON-like documents
{
_id: 1,
name: "John",
orders: [{ product: "Book", price: 29.99 }]
}Use for: Content management, catalogs, user profiles Examples: MongoDB, CouchDB, Firebase Firestore
2. Key-Value Stores
code.jsJavaScript
key: "user:1001"
value: { name: "John", email: "john@example.com" }Use for: Caching, sessions, real-time data Examples: Redis, DynamoDB, Memcached
3. Column-Family (Wide Column)
code.jsJavaScript
Row Key: user1
Column Family: profile
name: "John"
email: "john@example.com"
Column Family: activity
lastLogin: "2024-01-15"
loginCount: 42Use for: Time-series, analytics, large scale Examples: Cassandra, HBase, ScyllaDB
4. Graph Databases
code.jsJavaScript
(John)-[:FOLLOWS]->(Alice)
(John)-[:LIKES]->(Post)Use for: Social networks, recommendations, fraud detection Examples: Neo4j, Amazon Neptune, ArangoDB
Comparison
| Type | Schema | Query | Scale |
|---|---|---|---|
| Document | Flexible | Rich queries | Horizontal |
| Key-Value | None | Key lookup | Horizontal |
| Column | Semi-flexible | Column queries | Massive |
| Graph | Nodes/Edges | Traversals | Complex |