MongoDB Tutorial 0/120 lessons ~6 min read Lesson 29

    MongoDB Design Patterns

    MongoDB has a catalogue of design patterns formally published by MongoDB Inc.

    Course progress0%
    Focus
    4 guided sections
    Practice signal
    Examples included
    Career prep
    Foundation builder

    Introduction

    MongoDB has a catalogue of design patterns formally published by MongoDB Inc. — Bucket, Outlier, Attribute, Subset, Computed, Extended Reference, Polymorphic, Schema Versioning. Each solves a recurring modeling problem.

    Understanding the topic

    The big six:

    • Bucket — group time-series points (e.g. one doc per minute).
    • Outlier — special-case the 0.1% of huge docs.
    • Subset — store hot data in parent, cold in a sibling.
    • Extended Reference — store ref + a few denormalized fields.
    • Computed — pre-aggregate counters on write.
    • Schema Versioning — add a schemaVersion field.

    Real-world use

    Bucket pattern compresses IoT telemetry 10×. Computed pattern keeps Reddit-style vote counts instant.

    Best practices

    • Name patterns explicitly in code comments — future maintainers will thank you.
    • Don't over-apply; reach for them when a real bottleneck appears.
    Ready to mark this lesson complete?Track your journey across the entire course.