Articles → MONGODB → Partial Index In Mongodb
Partial Index In Mongodb
Purpose
Example
db.restaurants.createIndex(
{ borough: 1, cuisine: 1 },
{ partialFilterExpression: { 'rating.grade': { $eq: "A" } } }
)
db.restaurants.find( { borough: "Bronx", 'rating.grade': "A" } ).explain("executionStats")