Subset pattern

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Schema patterns

What it does

Optimizes frequent reads without embedding the entire history.

Syntax

Bounded hot subset plus full data separately

Use case

Display latest reviews while retaining full history.

Subset pattern: practical example
{ _id: productId, latestReviews: [{ rating: 5, excerpt: "Great" }] }
💡 Explanation Optimizes frequent reads without embedding the entire history. When to use it Display latest reviews while retaining full history.
Key Takeaways
  • Optimizes frequent reads without embedding the entire history.
  • Typical use: Display latest reviews while retaining full history.