MongoDB
Basic Schema Design Patterns
Inheritance Pattern
To apply the Inheritance Pattern to documents in a collection, you can use the aggregation framew...
Computed Pattern
Use Case: running a function frequently degrade performance, for example: calculate the average ...
Approximation Pattern
When data is changing constantly, and exact statistic is not critical, we can use approximations ...
Extended Reference Pattern
Joins are expensive so store some must have data into the child to avoid joins. This creates dat...
Schema Versioning Pattern
add a schema_version field to the document To Handle multiple versions: application handles bo...
Advanced Schema Design Patterns
Single Collection Pattern
The single collection pattern groups related documents of different types into a single collectio...
Subset Pattern
a book have N reviews only embed 3 reviews to the book Code Summary: Subset Pattern To apply th...
Bucket Pattern
The bucket pattern: groups pieces of information into buckets keep documents size predictable re...
Outlier Pattern
used when some documents are different and needs a different method to interact. example: most of...
Archive Pattern
Move data no longer needed to a different place so performance is not dragged. archive book revi...
Schema Design Anti Patterns
Schema Lifecycle Management
Schema Validation
To create a new "sales" collection schema validation, we use the createCollection method with the...
Schema Evolution
In this example, we implemented the updated reviews schema to include an optional locale field, i...
Schema Migration
Schema migration is transition from one schema to the next Migration Strategies: Eager: all at o...