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

Consider this two-stage pipeline. Assume an index exists on { status: 1, createdAt: -1 }. What does the query optimizer actually do with the $sort relative to the $match, and how does it affect blocking behavior?

db.orders.aggregate([ { $match: { status: "shipped" } }, { $sort: { createdAt: -1 } } ])