Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardMongoDBAggregation pipeline executionSingle-choice MCQ

A pipeline begins [{$match}, {$sort}] where $match filters on field a and $sort is on field b, with a compound index {a:1, b:1}. The explain shows no in-memory SORT stage at all. What internal property of the index makes the sort free here?

// index: { a: 1, b: 1 } db.c.aggregate([ { $match: { a: 42 } }, { $sort: { b: 1 } } ])