Schema Design Decision Framework
Learners will apply a structured checklist—query patterns, write frequency, document growth—to choose between embedding and referencing for any domain.
Why a Decision Framework Matters
MongoDB's schema flexibility is powerful but can lead to analysis paralysis. Should you embed or reference? When is the choice not obvious? A structured decision framework replaces guesswork with a repeatable checklist. By asking the same questions about query patterns, write frequency, and document growth, you can arrive at the right schema for any domain—consistently.
Step 1: Identify Query Patterns
Start by listing the most frequent read queries your application makes. Ask: do these queries always need the parent and children together, or are children queried independently? If child data is almost always fetched with its parent, embedding eliminates a round trip. If children are frequently queried, sorted, or filtered on their own, referencing keeps queries simple and indexes focused.
All lessons in this course
- Embedding: One-to-Few Relationships
- Referencing: One-to-Many and Many-to-Many
- The Unbounded Array Anti-Pattern
- Schema Design Decision Framework