- Reference >
mongoShell Methods >- Collection Methods >
- db.collection.dropIndexes()
db.collection.dropIndexes()¶
On this page
-
db.collection.dropIndexes()¶ Drops all indexes other than the required index on the
_idfield. Only calldropIndexes()as a method on a collection object.
Warning
This command obtains a write lock on the affected database and will block other operations until it has completed.
Behavior¶
Dropping an Index during Index Replication¶
Avoid dropping an index on a collection while any index is being replicated on a secondary. If you attempt to drop an index from a collection on a primary while the collection has a background index building on a secondary, reads will be halted across all namespaces and replication will halt until the background index build completes.