The dropIndexes command drops one or all indexes from the current collection. To drop all indexes, issue the command like so:

{ dropIndexes: "collection", index: "*" }

To drop a single, issue the command by specifying the name of the index you want to drop. For example, to drop the index named age_1, use the following command:

{ dropIndexes: "collection", index: "age_1" }

The shell provides a useful command helper. Here’s the equivalent command:



This command obtains a write lock on the affected database and will block other operations until it has completed.

←   listIndexes fsync  →

Was this page helpful?

Yes No

Thank you for your feedback!

We're sorry! You can Report a Problem to help us improve this page.