Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumMongoDBpartial and sparse indexesSingle-choice MCQ

You create a partial index on the `orders` collection so it only indexes documents where `status` equals 'active'. Given the query below, will MongoDB use this partial index?

// Index definition: db.orders.createIndex( { customerId: 1 }, { partialFilterExpression: { status: "active" } } ); // Query: db.orders.find({ customerId: 42, status: { $ne: "cancelled" } });