Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardMongoDBquery planner plan cacheSingle-choice MCQ

MongoDB's plan cache keys plans by 'query shape'. Which pair of queries produces the SAME plan cache key and therefore reuses the same cached plan?

// Collection has indexes: {status:1}, {status:1, createdAt:-1} A: db.c.find({ status: "active", createdAt: { $gt: ISODate("2024-01-01") } }) B: db.c.find({ status: "closed", createdAt: { $gt: ISODate("2025-06-01") } }) C: db.c.find({ status: "active" }).sort({ createdAt: -1 }) D: db.c.find({ status: { $in: ["active","closed"] }, createdAt: { $gt: ISODate("2024-01-01") } })