@@ -64,10 +64,10 @@ Definition
64
64
65
65
If an index specified to
66
66
:method:`db.collection.dropIndex()` is still building,
67
- :method:`~ db.collection.dropIndex()` attempts to abort the
68
- in-progress build. Aborting an index build has the same
67
+ :method:`db.collection.dropIndex()` attempts to stop the
68
+ in-progress build. Stopping an index build has the same
69
69
effect as dropping the built index. Prior to MongoDB 4.4,
70
- :method:`~ db.collection.dropIndex()` returned an error if
70
+ :method:`db.collection.dropIndex()` returned an error if
71
71
the specified index was still building. See
72
72
:ref:`dropIndex-method-index-builds` for more complete
73
73
documentation.
@@ -79,7 +79,9 @@ Definition
79
79
Behavior
80
80
--------
81
81
82
- .. include:: /includes/extracts/fact-method-dropIndex-query-behavior.rst
82
+ .. |drop-index| replace:: :method:`db.collection.dropIndex()`
83
+
84
+ .. include:: /includes/fact-drop-index-5.2.rst
83
85
84
86
Resource Locking
85
87
~~~~~~~~~~~~~~~~
@@ -90,43 +92,12 @@ Resource Locking
90
92
91
93
.. _dropIndex-method-index-builds:
92
94
93
- Aborts In-Progress Index Builds
94
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95
-
96
- .. versionadded:: 4.4
97
-
98
- If an index specified to :method:`db.collection.dropIndex()` is still
99
- being built, :method:`~db.collection.dropIndex()` attempts to abort
100
- the build. Aborting an index build has the same effect as dropping
101
- the built index. Prior to MongoDB 4.4,
102
- :method:`~db.collection.dropIndex()` returned an error if the
103
- specified index was still building.
104
-
105
- The index specified to :method:`~db.collection.dropIndex()` must be the
106
- only index associated to the index builder, i.e. the indexes built by a
107
- single :dbcommand:`createIndexes` or
108
- :method:`db.collection.createIndexes()` operation. If the associated
109
- index builder has other in-progress builds, wait until the builds
110
- complete and specify the index to :method:`~db.collection.dropIndex()`.
111
-
112
- For example, a :dbcommand:`createIndexes` /
113
- :method:`~db.collection.createIndexes()` operation creates three
114
- indexes. Assuming all three index builds are still in-progress,
115
- :method:`~db.collection.dropIndex()` cannot successfully abort any of
116
- the index builds and therefore cannot drop any of those indexes.
117
-
118
- Use :dbcommand:`currentOp` to identify the index builds associated to a
119
- :dbcommand:`createIndexes` / :method:`~db.collection.createIndexes()`
120
- operation. See :ref:`currentOp-cmd-index-creation` for an example.
121
-
122
- For replica sets or shard replica sets, aborting an index on the primary
123
- does not simultaneously abort secondary index builds.
124
- :method:`~db.collection.dropIndex()` attempts to abort the in-progress
125
- builds for the specified indexes on the :term:`primary` and if
126
- successful creates an associated "abort" oplog entry. :term:`Secondary
127
- <secondary>` members with replicated in-progress builds wait for a
128
- commit or abort oplog entry from the primary before either committing or
129
- aborting the index build.
95
+ Stop In-Progress Index Builds
96
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97
+
98
+ .. |drop-index| replace:: :method:`db.collection.dropIndex()`
99
+
100
+ .. include:: /includes/fact-stop-in-progress-index-builds.rst
130
101
131
102
Hidden Indexes
132
103
~~~~~~~~~~~~~~
@@ -151,7 +122,7 @@ Example
151
122
-------
152
123
153
124
Consider a ``pets`` collection. Calling the
154
- :method:`~ db.collection.getIndexes()` method on the ``pets`` collection
125
+ :method:`db.collection.getIndexes()` method on the ``pets`` collection
155
126
returns the following indexes:
156
127
157
128
.. code-block:: javascript
0 commit comments