Hi @karan_sharma3

If you have stopped 1 member of the replica set the index will not be maked as usable until it is restored and the index build completes on that member. This is because the default commitQuorum for an index build is votingMembers.

Alternatively the optional parameter commitQuorum can be provided to create an index when all the replica set members are not healthy.

example:

db.animations.createIndex({ status: 1}, {}, "majority"})

refs:
https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndex/#std-label-createIndex-method-commitQuorum

edit: correct format

2 Likes