@@ -65,6 +65,17 @@ resulting index.
6565 only creates an index if an index of the same specification does
6666 not already exist.
6767
68+ Special Creation Options
69+ ~~~~~~~~~~~~~~~~~~~~~~~~
70+
71+ .. note::
72+
73+ TTL collections use a special ``expire`` index option. See
74+ :doc:`/tutorial/expire-data` for more information.
75+
76+ .. TODO: insert link here to the geospatial index documents when
77+ they're published.
78+
6879Sparse Indexes
6980``````````````
7081
@@ -135,6 +146,46 @@ You can also enforce a unique constraint on :ref:`compound indexes
135146These indexes enforce uniqueness for the *combination* of index keys
136147and *not* for either key individually.
137148
149+ Background
150+ ``````````
151+
152+ To create an index in the background you can specify :ref:`background
153+ construction <index-creation-background>`. Consider the following
154+ prototype invocation of :method:`db.collection.ensureIndex()`:
155+
156+ .. code-block:: javascript
157+
158+ db.collection.ensureIndex( { a: 1 }, { background: true } )
159+
160+ Consider the section on :ref:`background index construction
161+ <index-creation-background>` for more information about these indexes
162+ and their implications.
163+
164+ Drop Duplicates
165+ ```````````````
166+
167+ To force the creation of a :ref:`unique index <index-type-unique>`
168+ index on a collection with duplicate values in the field you are
169+ indexing you can use the ``dropDups`` option. This will force MongoDB
170+ to create a *unique* index by deleting documents with duplicate values
171+ when building the index. Consider the following prototype invocation
172+ of :method:`db.collection.ensureIndex()`:
173+
174+ .. code-block:: javascript
175+
176+ db.collection.ensureIndex( { a: 1 }, { dropDups: true } )
177+
178+ See the full documentation of :ref:`duplicate dropping
179+ <index-creation-duplicate-dropping>` for more information.
180+
181+ .. warning::
182+
183+ Specifying ``{ dropDups: true }`` may delete data from your
184+ database. Use with extreme caution.
185+
186+ Refer to the :method:`ensureIndex() <db.collection.ensureIndex()>`
187+ documentation for additional index creation options.
188+
138189Removal
139190~~~~~~~
140191
@@ -159,7 +210,7 @@ Where the value of ``nIndexesWas`` reflects the number of indexes
159210for the :ref:`_id index <index-type-primary>` from a collection.
160211
161212These shell helpers provide wrappers around the
162- :dbcommand:`deleteIndexes ` :term:`database command`. Your :doc:`client
213+ :dbcommand:`dropIndexes ` :term:`database command`. Your :doc:`client
163214library </applications/drivers>` may have a different or additional
164215interface for these operations.
165216
@@ -203,54 +254,6 @@ may have a different or additional interface for this operation.
203254
204255.. include:: /includes/note-build-indexes-on-replica-sets.rst
205256
206- Special Creation Options
207- ~~~~~~~~~~~~~~~~~~~~~~~~
208-
209- .. note::
210-
211- TTL collections use a special ``expire`` index option. See
212- :doc:`/tutorial/expire-data` for more information.
213-
214- .. TODO: insert link here to the geospatial index documents when
215- they're published.
216-
217- Background
218- ``````````
219-
220- To create an index in the background you can specify :ref:`background
221- construction <index-creation-background>`. Consider the following
222- prototype invocation of :method:`db.collection.ensureIndex()`:
223-
224- .. code-block:: javascript
225-
226- db.collection.ensureIndex( { a: 1 }, { background: true } )
227-
228- Consider the section on :ref:`background index construction
229- <index-creation-background>` for more information about these indexes
230- and their implications.
231-
232- Drop Duplicates
233- ```````````````
234-
235- To force the creation of a :ref:`unique index <index-type-unique>`
236- index on a collection with duplicate values in the field you are
237- indexing you can use the ``dropDups`` option. This will force MongoDB
238- to create a *unique* index by deleting documents with duplicate values
239- when building the index. Consider the following prototype invocation
240- of :method:`db.collection.ensureIndex()`:
241-
242- .. code-block:: javascript
243-
244- db.collection.ensureIndex( { a: 1 }, { dropDups: true } )
245-
246- See the full documentation of :ref:`duplicate dropping
247- <index-creation-duplicate-dropping>` for more information.
248-
249- .. warning::
250-
251- Specifying ``{ dropDups: true }`` may delete data from your
252- database. Use with extreme caution.
253-
254257.. _index-building-replica-sets:
255258
256259Building Indexes on Replica Sets
0 commit comments