0Pricing
MongoDB Academy · Lesson

NoSQL Flavors: Document, Key-Value, Column, Graph

Learners will compare the four NoSQL families and map each to real-world use cases.

NoSQL Flavors: Document, Key-Value, Column, Graph is a free MongoDB Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MongoDB Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The NoSQL Family Tree

"NoSQL" isn't one thing — it's a family of four: document, key-value, wide-column, and graph stores. MongoDB is a document store. Let's meet them all.

Document Stores: Rich Nested Data

Document stores keep data as flexible JSON-like documents, with nested objects and arrays all in one place. MongoDB leads here — the most versatile NoSQL type.

// Document store example - a product document
{
  _id: 'prod_001',
  name: 'Wireless Headphones',
  category: 'Electronics',
  specs: { battery: '30h', connectivity: 'Bluetooth 5.0' },
  reviews: [
    { user: 'alice', rating: 5, comment: 'Great!' }
  ],
  price: 79.99
}

Key-Value Stores: Blazing Fast Simplicity

Key-value stores like Redis are the simplest: every item is just a key and a value. Lookups are instant, perfect for caches, sessions, and leaderboards.

// Redis key-value example
SET session:user_42 '{"userId":42,"token":"abc123","expiresAt":1700000000}'
GET session:user_42
// Returns the JSON string immediately - O(1) lookup

// Redis also supports richer structures per key:
LPUSH leaderboard 'alice:9500'
LPUSH leaderboard 'bob:8700'
LRANGE leaderboard 0 9  // top 10

Wide-Column Stores: Analytical Scale

Wide-column stores like Cassandra spread data across many machines and swallow huge write loads. Ideal for IoT sensors, logs, and time-series data.

// Cassandra CQL - wide-column table design
CREATE TABLE sensor_readings (
  device_id  UUID,
  recorded_at TIMESTAMP,
  temperature FLOAT,
  humidity    FLOAT,
  PRIMARY KEY (device_id, recorded_at)
) WITH CLUSTERING ORDER BY (recorded_at DESC);
// Partition key = device_id; clustering key = recorded_at

Graph Databases: Relationships First

Graph databases like Neo4j store connections as first-class data, so they fly through relationships. Great for social networks, fraud rings, and recommendations.

// Neo4j Cypher query - find friends of friends
MATCH (me:Person {name: 'Alice'})
      -[:FRIENDS_WITH]->(friend)
      -[:FRIENDS_WITH]->(foaf)
WHERE NOT (me)-[:FRIENDS_WITH]->(foaf)
  AND foaf <> me
RETURN foaf.name AS suggestion
LIMIT 10;

Comparing the Four Families

Each family shines somewhere: documents for most apps, key-value for caching, wide-column for IoT, graph for relationships. Always ask: how will I query my data?

When to Use a Document Store

Reach for a document store like MongoDB when your data is nested, your schema keeps changing, and you want rich queries without painful JOINs.

Multi-Model Databases

Big systems often mix databases — a pattern called polyglot persistence. MongoDB for data, Redis for caching, each tool doing what it does best.

NewSQL: The Best of Both Worlds?

NewSQL databases like CockroachDB try to blend NoSQL's scaling with SQL's safety. The SQL vs NoSQL choice is less black-and-white than it used to be.

MongoDB in the NoSQL Landscape

MongoDB leads document stores thanks to its BSON format, rich queries, ACID transactions, and the Atlas cloud platform. Often your first and best NoSQL stop.

Choosing the Right NoSQL Family

Quick guide: single-key lookups go to Redis, relationships to Neo4j, time-series to Cassandra, rich nested data to MongoDB. Unsure? MongoDB is a safe start.

Quick Check

Test your understanding of MongoDB & NoSQL Databases concepts from this lesson.

Lesson Recap

You met the four NoSQL families, saw why MongoDB's documents fit most apps, and learned how polyglot persistence mixes tools. Next: the CAP theorem.

Frequently asked questions

Is the “NoSQL Flavors: Document, Key-Value, Column, Graph” lesson free?

Yes — the full text of “NoSQL Flavors: Document, Key-Value, Column, Graph” is free to read here on the web, and the MongoDB Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MongoDB Academy course, upgrade to CoddyKit PRO.

What will I learn in “NoSQL Flavors: Document, Key-Value, Column, Graph”?

Learners will compare the four NoSQL families and map each to real-world use cases. You practise MongoDB Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start MongoDB Academy?

No prior experience is required. MongoDB Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “NoSQL Flavors: Document, Key-Value, Column, Graph” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this MongoDB Academy lesson?

Yes. Every MongoDB Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. The Relational Database Bottleneck
  2. NoSQL Flavors: Document, Key-Value, Column, Graph
  3. The CAP Theorem in Plain English
  4. Where MongoDB Fits In
← Back to MongoDB Academy