- Reference >
- JavaScript Methods >
- db.collection.reIndex()
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:
Change
collection
to the name of the collection that you want to rebuild the index.