MongoDB index with specific field value

db.collection.createIndex(
   { account_id: 1, state: 1 },
   { unique: true, partialFilterExpression: { state: stateOne } }
)
Topics: MongoDB

Related Code Examples