diff --git a/source/administration/indexes.txt b/source/administration/indexes.txt index 89134d21a04..d7280733f3f 100644 --- a/source/administration/indexes.txt +++ b/source/administration/indexes.txt @@ -65,6 +65,17 @@ resulting index. only creates an index if an index of the same specification does not already exist. +Special Creation Options +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. note:: + + TTL collections use a special ``expire`` index option. See + :doc:`/tutorial/expire-data` for more information. + +.. TODO: insert link here to the geospatial index documents when + they're published. + Sparse Indexes `````````````` @@ -135,6 +146,46 @@ You can also enforce a unique constraint on :ref:`compound indexes These indexes enforce uniqueness for the *combination* of index keys and *not* for either key individually. +Background +`````````` + +To create an index in the background you can specify :ref:`background +construction `. Consider the following +prototype invocation of :method:`db.collection.ensureIndex()`: + +.. code-block:: javascript + + db.collection.ensureIndex( { a: 1 }, { background: true } ) + +Consider the section on :ref:`background index construction +` for more information about these indexes +and their implications. + +Drop Duplicates +``````````````` + +To force the creation of a :ref:`unique index ` +index on a collection with duplicate values in the field you are +indexing you can use the ``dropDups`` option. This will force MongoDB +to create a *unique* index by deleting documents with duplicate values +when building the index. Consider the following prototype invocation +of :method:`db.collection.ensureIndex()`: + +.. code-block:: javascript + + db.collection.ensureIndex( { a: 1 }, { dropDups: true } ) + +See the full documentation of :ref:`duplicate dropping +` for more information. + +.. warning:: + + Specifying ``{ dropDups: true }`` may delete data from your + database. Use with extreme caution. + +Refer to the :method:`ensureIndex() ` +documentation for additional index creation options. + Removal ~~~~~~~ @@ -159,7 +210,7 @@ Where the value of ``nIndexesWas`` reflects the number of indexes for the :ref:`_id index ` from a collection. These shell helpers provide wrappers around the -:dbcommand:`deleteIndexes` :term:`database command`. Your :doc:`client +:dbcommand:`dropIndexes` :term:`database command`. Your :doc:`client library ` may have a different or additional interface for these operations. @@ -203,54 +254,6 @@ may have a different or additional interface for this operation. .. include:: /includes/note-build-indexes-on-replica-sets.rst -Special Creation Options -~~~~~~~~~~~~~~~~~~~~~~~~ - -.. note:: - - TTL collections use a special ``expire`` index option. See - :doc:`/tutorial/expire-data` for more information. - -.. TODO: insert link here to the geospatial index documents when - they're published. - -Background -`````````` - -To create an index in the background you can specify :ref:`background -construction `. Consider the following -prototype invocation of :method:`db.collection.ensureIndex()`: - -.. code-block:: javascript - - db.collection.ensureIndex( { a: 1 }, { background: true } ) - -Consider the section on :ref:`background index construction -` for more information about these indexes -and their implications. - -Drop Duplicates -``````````````` - -To force the creation of a :ref:`unique index ` -index on a collection with duplicate values in the field you are -indexing you can use the ``dropDups`` option. This will force MongoDB -to create a *unique* index by deleting documents with duplicate values -when building the index. Consider the following prototype invocation -of :method:`db.collection.ensureIndex()`: - -.. code-block:: javascript - - db.collection.ensureIndex( { a: 1 }, { dropDups: true } ) - -See the full documentation of :ref:`duplicate dropping -` for more information. - -.. warning:: - - Specifying ``{ dropDups: true }`` may delete data from your - database. Use with extreme caution. - .. _index-building-replica-sets: Building Indexes on Replica Sets diff --git a/source/reference/command/repairDatabase.txt b/source/reference/command/repairDatabase.txt index 975bf26d12f..8fcdce9a56c 100644 --- a/source/reference/command/repairDatabase.txt +++ b/source/reference/command/repairDatabase.txt @@ -21,9 +21,12 @@ repairDatabase there are no errors in the data storage. As a side effect, the :dbcommand:`repairDatabase` command will - compact the database, as the :dbcommand:`compact` command and - reduce the total size of the data files on disk. Use the following - syntax: + compact the database, as the :dbcommand:`compact` command and reduce + the total size of the data files on disk. The + :dbcommand:`repairDatabase` command will also recreate all indexes + in the database. + + Use the following syntax: .. code-block:: javascript