MongoDB Tutorial 0/120 lessons ~6 min read Lesson 23
Data Modeling
Data modeling in MongoDB is the craft of turning real-world entities into documents that fit your queries.
Course progress0%
Focus
4 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
Data modeling in MongoDB is the craft of turning real-world entities into documents that fit your queries. Unlike SQL, where normalization is the default, MongoDB rewards denormalization for read patterns.
Understanding the topic
Modeling principles:
- Design for the dominant read pattern.
- Duplicate small, slow-changing data when it speeds up reads.
- Avoid joins on hot paths — embed instead.
- Use
$lookupfor occasional or admin queries. - Plan for growth — bounded arrays, separate collections for hot vs cold data.
Real-world use
An order document might embed a snapshot of the customer's name + shipping address at the time of purchase, so historical orders stay stable even if the customer profile changes.
Best practices
- Use the 'Six Rules of Thumb' from MongoDB's modeling guide.
- Snapshot critical fields you don't want to change retroactively.
Ready to mark this lesson complete?Track your journey across the entire course.