- Indexes >
- Indexing Tutorials >
- Index Management Tutorials >
- Rebuild Indexes
Rebuild Indexes¶
On this page
If you need to rebuild indexes for a collection you can use the
db.collection.reIndex()
method to rebuild all indexes on a
collection in a single operation. This operation drops all indexes,
including the _id index, and then rebuilds all
indexes.
See also
Process¶
The operation takes the following form:
MongoDB will return the following document when the operation completes:
This shell helper provides a wrapper around the reIndex
database command. Your client library
may have a different or additional interface for this operation.
Additional Considerations¶
Note
To build indexes for a replica set see Build Indexes on Replica Sets.