On this page
NoSQL Schema Design Patterns
Prev: CAP, PACELC & Consistency Models | Up: nosql | Next: sqlite3
Rel: MongoDB BSON & Schema Design, Normalization & Data Modeling
Ref: MongoDB — Data Modeling
Tags: #public #databases #nosql #design-patterns
Contents
Access-Pattern-First Design
Relational modeling starts with entities and normal forms; NoSQL modeling starts with the exact queries your application executes most frequently, aiming to serve hot reads in a single document/partition fetch.
Core Document Modeling Patterns
- Embedding (Denormalized): Store tightly coupled 1-to-1 or bounded 1-to-few sub-objects inside the parent document (e.g., shipping address on an order).
- Extended Reference: Embed only the frequently displayed subset of a related entity (
{ authorId, authorName }) while keeping the full entity in its own collection. - Bucket Pattern: Group streams of fine-grained events (IoT readings, chat messages) into fixed-size or time-windowed array buckets (e.g., 100 events/doc) to shrink index size.
- Outlier Pattern: Keep normal documents compact and set
hasOverflow: truelinking to overflow documents only for extreme 1-to-millions outliers (e.g., celebrity accounts). - Computed Pattern: Pre-calculate expensive totals/averages on write rather than recomputing on every read.
Linked from
Related notes
- tuts/databases/mongodb/bson_documents_and_schema_design Linked here; links to this page; shared tags: #databases, #nosql
- tuts/databases/nosql Linked here; links to this page; shared tags: #databases, #nosql
- tuts/databases/nosql/cap_pacelc_and_consistency Linked here; links to this page; shared tags: #databases, #nosql
- tuts/databases/design_patterns/normalization_and_data_modeling Linked here; links to this page; shared tags: #databases
- tuts/databases/sqlite3 Linked here; shared tags: #databases
- tuts/databases/mongodb shared tags: #databases, #nosql
- tuts/databases/mongodb/crud_and_aggregation_pipeline shared tags: #databases, #nosql
- tuts/databases/mongodb/indexes_replica_sets_and_transactions shared tags: #databases, #nosql
- tuts/databases/nosql/nosql_data_models shared tags: #databases, #nosql
- tuts/databases shared tags: #databases