Skip to content

DOCS-1184 indexStats() command #915

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

Closed
wants to merge 1 commit into from
Closed
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
33 changes: 33 additions & 0 deletions source/core/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,39 @@ the ``a`` field.
.. [#hash-size] The hash stored in the ``hashed`` index is 64 bits of the
128 bit ``md5`` hash.

.. index:: index; name
.. _index-names:

Index Names
-----------

The default name for an index is the concatenation of the indexed keys
and each key's direction in the index (1 or -1).

.. example:: Issue the following command to create an index on ``item``
and ``quantity``:

.. code-block:: javascript

db.products.ensureIndex( { item: 1, quantity: -1 } )

The resulting index is named: ``item_1_quantity_-1``.

Optionally. you can specify a name for an index instead of using the
default name.

.. example:: Issue the following command to create an index on ``item``
and ``quantity`` and specify ``inventory`` as the index name:

.. code-block:: javascript

db.products.ensureIndex( { item: 1, quantity: -1 } , {name: "inventory"} )

The resulting index is named: ``inventory``.

To view the name of an index, use the :method:`getIndexes()
<db.collection.getIndexes()>` method.

.. index:: index; options
.. _index-creation-operations:
.. _index-operations:
Expand Down
1 change: 1 addition & 0 deletions source/reference.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Status and Reporting
reference/database-profiler
reference/explain
reference/exit-codes
reference/index-stats

Internal Metadata
-----------------
Expand Down
29 changes: 29 additions & 0 deletions source/reference/command/indexStats.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
==========
indexStats
==========

.. default-domain:: mongodb

.. dbcommand:: indexStats

The :dbcommand:`indexStats` command aggregates statistics
for the B-tree data structure that stores data for a MongoDB index.

.. warning:: This command is not intended for production deployments.

The command can be run *only* on a :program:`mongod` instance that uses
the ``--enableExperimentalIndexStatsCmd`` option.

To aggregate statistics, issue the command like so:

.. code-block:: javascript

db.runCommand( { indexStats: "<collection>", index: "<index name>" } )

For more information on the command's limits and output, see the following:

- The equivalent :method:`db.collection.indexStats()` method

- :doc:`/reference/index-stats`

- `https://github.com/10gen-labs/storage-viz#readme <https://github.com/10gen-labs/storage-viz#readme>`_.
Loading