Navigation
This version of the documentation is archived and no longer supported.

db.collection.reIndex()

db.collection.reIndex()

This method drops all indexes and recreates them. This operation may be expensive for collections that have a large amount of data and/or a large number of indexes.

Call this method, which takes no arguments, on a collection object. For example:

db.collection.reIndex()

Change collection to the name of the collection that you want to rebuild the index.