Advanced MongoDB: Indexes, Aggregation & Schema
Go beyond the basics in MongoDB: design schemas around your queries, choose between embedding and referencing, speed up reads with indexes you can verify with explain, and summarise data with aggregation pipelines. For developers who know the fundamentals.
Instructor: iCourse Team. Duration: 1 hr. Category: Databases.
Lessons
- Model your data for your queries (5 min)
- Embed or reference? (5 min)
- Indexes and explain (6 min)
- Compound indexes and the ESR rule (6 min)
- Index trade-offs (5 min)
- Aggregation pipelines (7 min)
- $unwind, $lookup and reshaping (7 min)
- Making pipelines fast (6 min)
- Schema validation (7 min)
- Capstone: shop analytics (6 min)
What you will learn
- Design documents around the queries your application runs
- Choose between embedding and referencing, and spot unbounded arrays
- Read explain output to see whether a query uses an index
- Build compound indexes with the Equality, Sort, Range guideline
- Write aggregation pipelines with $match, $group, $unwind, $lookup and $sort
- Add schema validation to a collection and understand what it enforces
Before you start
- Comfortable with insert, find, update and delete in mongosh (the Introduction to MongoDB course covers this)
- A basic idea of what a database index is helps, but is not required
- Optional: mongosh and a MongoDB instance to run the examples
All courses