1.Schema design as workload-driven design
A MongoDB schema is designed around how the app reads and writes data, not around normalizing entities. The same real-world data can be modeled two very different ways depending on the workload.
Key features
- Core principle: data accessed together should be stored together
- The workload — patterns, frequency, latency — drives the shape, not normalization
- The same data can be modeled differently for apps with different access patterns
- A schema optimized for one workload can perform poorly for a different one
- Called a "core senior skill" — it requires knowing the app, not just the data
- access patterns — what gets queried, how often
- schema shape — documents, embedding, indexes
- performance — the point of the exercise
Command
// Not a syntax — a design order: access patterns first, document shape second.Design the schema around the application's actual read/write patterns first — not around normalized entities the way a relational schema would be.