/
dropIndexes.txt
40 lines (26 loc) · 970 Bytes
/
dropIndexes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
===========
dropIndexes
===========
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
.. dbcommand:: dropIndexes
The :dbcommand:`dropIndexes` command drops one or all indexes from
the current collection.
To drop all indexes, issue the command like so:
.. code-block:: javascript
{ 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:
.. code-block:: javascript
{ dropIndexes: "collection", index: "age_1" }
The shell provides a useful command helper. Here's the equivalent command:
.. code-block:: javascript
db.collection.dropIndex("age_1");
.. warning::
This command obtains a write lock on the affected database and
will block other operations until it has completed.