In mongo, you can rebuild all indexes with
db.collection.reIndex()
But is there a way to rebuild a single index?
Thanks,
Kevin
In mongo, you can rebuild all indexes with
db.collection.reIndex()
But is there a way to rebuild a single index?
Thanks,
Kevin
2
Answers
It’s very costly operation and blocks all the operations on the collection for the duration.
And 5.0 onwards,
reIndex
will be restricted to standalone instances.Identify all your indexes with:
Find the one you want to rebuild, e.g.:
"Safely" drop and rebuild with explicit specification instead of name: