Skip to content

DOCS-286 Redirect Indexing Commands Page #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 52 additions & 49 deletions source/administration/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
``````````````

Expand Down Expand Up @@ -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 <index-creation-background>`. 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
<index-creation-background>` for more information about these indexes
and their implications.

Drop Duplicates
```````````````

To force the creation of a :ref:`unique index <index-type-unique>`
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
<index-creation-duplicate-dropping>` for more information.

.. warning::

Specifying ``{ dropDups: true }`` may delete data from your
database. Use with extreme caution.

Refer to the :method:`ensureIndex() <db.collection.ensureIndex()>`
documentation for additional index creation options.

Removal
~~~~~~~

Expand All @@ -159,7 +210,7 @@ Where the value of ``nIndexesWas`` reflects the number of indexes
for the :ref:`_id index <index-type-primary>` 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 </applications/drivers>` may have a different or additional
interface for these operations.

Expand Down Expand Up @@ -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 <index-creation-background>`. 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
<index-creation-background>` for more information about these indexes
and their implications.

Drop Duplicates
```````````````

To force the creation of a :ref:`unique index <index-type-unique>`
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
<index-creation-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
Expand Down
9 changes: 6 additions & 3 deletions source/reference/command/repairDatabase.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down