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

This pipeline runs where 'orders' is the source and 'products' is the foreign collection with an index on { sku: 1 }. The localField/foreignField $lookup executes as an indexed nested-loop join. The optimizer adds a small per-operation cache for the foreign side. What does this cache do, and when does it help most?

db.orders.aggregate([ { $lookup: { from: "products", localField: "sku", foreignField: "sku", as: "product" } } ])