Skip to content
Ameen Abozaid
Planned lessonMID-041-L02

Key-value and document stores

  • Lesson 2 of 6
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

describe the two most common models.

Planned topics

  • Key-value (Redis, DynamoDB basics): fetch by key; very fast; no query by value unless you build an index.
  • Document (MongoDB): JSON-like documents with nested data and flexible fields; indexes on fields; query inside the document.
  • Document fits data read as a unit: a review with its comments, a product with attributes.
  • Consistency: single-document writes are atomic; cross-document needs transactions or design around them.
Draft outline details

Demonstration

json
{ "_id": "r1", "productId": 42, "rating": 5, "text": "Great", "tags": ["fast"] }

Lookup by _id is O(1) in a key-value store; querying by productId needs an index in a document store.

Check your understanding

What is a document store good at?

Show answer

Reading and writing a nested object as one unit.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.