Back to roadmap
Module 7 · NoSQL, Search, Graph, ObjectDay 05920 min

Document Stores

JSON-shaped data, flexible schemas, easy aggregations.

Day 059

Document Stores

App
service
Mongo
datastore
Collection
datastore
Signal path
Documents in collections
App
service
flow
Mongo
datastore
Mongo
datastore
flow
Collection
datastore
Memory hook

Document Stores: json-shaped data, flexible schemas, easy aggregations

Mental model

match the datastore to the access pattern

Design lens

Flexibility helps fast iteration.

Recall anchors
SchemaQueries

Why it matters

Document stores (MongoDB, Couchbase) treat each record as a JSON-like document. They suit varied, nested, or evolving data, and let you index nested fields directly.

Deep dive

Schemas exist; they live in your code instead of the DB.

Aggregation pipelines support powerful queries within a doc.

Cross-document joins are weak; denormalize or use $lookup sparingly.

Demo / scenario

Catalog with varied product attributes.

  1. Each product is a doc with category-specific fields.
  2. Index on category + price for filters.
  3. Aggregation pipeline computes facets.
  4. Versioning of fields via app code.

Tradeoffs

  • Flexibility helps fast iteration.
  • Schema drift bites later — invest in validation.
  • Joins are awkward; design around them.

Diagram

App
Mongo
Collection
Documents in collections.

Mind map

Check yourself

Loading quiz…

Sources & further reading