Skip to content

DOCS-1474 moved collection statistics output into collStats #949

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 3 commits 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
8 changes: 8 additions & 0 deletions bin/htaccess.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,14 @@ redirect-path: '/reference/commands'
url-base: '/reference/command'
type: 'redirect'
code: 301
outputs:
- 'after-v2.2'
- 'manual'
---
redirect-path: '/reference/collection-statistics'
url-base: '/reference/command/collStats'
type: 'redirect'
code: 301
outputs:
- 'after-v2.2'
- 'manual'
Expand Down
2 changes: 1 addition & 1 deletion source/administration/monitoring.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ utilization between databases and to determine average
``collStats``
`````````````

The :doc:`collStats data </reference/collection-statistics>` is
The :doc:`collStats data </reference/command/collStats>` is
accessible using the :dbcommand:`collStats` command
(:method:`db.printCollectionStats()` from the shell). It provides
statistics that resemble :dbcommand:`dbStats` on the collection level:
Expand Down
2 changes: 1 addition & 1 deletion source/core/document.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ MongoDB contexts:

- the output of a number of MongoDB commands and operations, including:

- the :doc:`output </reference/collection-statistics>`
- the output
of :dbcommand:`collStats` command, and

- the :doc:`output </reference/command/serverStatus>` of the
Expand Down
2 changes: 1 addition & 1 deletion source/meta/reference.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Status, Monitoring, and Reporting Output

/reference/command/serverStatus
/reference/database-statistics
/reference/collection-statistics
/reference/command/collStats
/reference/connection-pool-stats
/reference/replica-status
/reference/exit-codes
Expand Down
2 changes: 1 addition & 1 deletion source/reference.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Status and Reporting
:maxdepth: 1

reference/database-statistics
reference/collection-statistics
reference/command/collStats
reference/collection-validation
reference/connection-pool-stats
reference/current-op
Expand Down
177 changes: 0 additions & 177 deletions source/reference/collection-statistics.txt

This file was deleted.

135 changes: 133 additions & 2 deletions source/reference/command/collStats.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ collStats

.. default-domain:: mongodb

Definition
----------

.. dbcommand:: collStats

The :dbcommand:`collStats` command returns a variety of storage statistics
Expand Down Expand Up @@ -47,6 +50,134 @@ collStats
The scale factor rounds values to whole numbers. This can
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potentially link above cross reference directly to this section.

produce unpredictable and unexpected results in some situations.

.. seealso:: ":doc:`/reference/collection-statistics`."
Output
------

.. data:: collStats.ns

The namespace of the current collection, which follows the format
``[database].[collection]``.

.. data:: collStats.count

The number of objects or documents in this collection.

.. data:: collStats.size

The size of the data stored in this collection. This value does not
include the size of any indexes associated with the collection,
which the :data:`~collStats.totalIndexSize` field reports.

The ``scale`` argument affects this value.

.. data:: collStats.avgObjSize

The average size of an object in the collection. The ``scale``
argument affects this value.

.. data:: collStats.storageSize

The total amount of storage allocated to this collection for
:term:`document` storage. The ``scale`` argument affects this
value. The :data:`~collStats.storageSize` does not decrease as you remove or
shrink documents.

.. sum of all extents (no indexes or the $freelist)
.. include links to eventual documentation of storage management

.. data:: collStats.numExtents

The total number of contiguously allocated data file regions.

.. data:: collStats.nindexes

The number of indexes on the collection. All collections have at
least one index on the :term:`_id` field.

.. versionchanged:: 2.2
Before 2.2, capped collections did not necessarily have an
index on the ``_id`` field, and some capped collections created
with pre-2.2 versions of :program:`mongod` may not have an
``_id`` index.


.. data:: collStats.lastExtentSize

The size of the last extent allocated. The ``scale`` argument
affects this value.

.. data:: collStats.paddingFactor

The amount of space added to the end of each document at insert
time. The document padding provides a small amount of extra space
on disk to allow a document to grow slightly without needing to
move the document. :program:`mongod` automatically calculates this
padding factor

.. data:: collStats.flags

.. versionchanged:: 2.2
Removed in version 2.2 and replaced with the :data:`~collStats.userFlags`
and :data:`~collStats.systemFlags` fields.

Indicates the number of flags on the current collection. In version
2.0, the only flag notes the existence of an :term:`index` on the
:term:`_id` field.

.. data:: collStats.systemFlags

.. versionadded:: 2.2

Reports the flags on this collection that reflect internal server
options. Typically this value is ``1`` and reflects the existence
of an :term:`index` on the ``_id`` field.

.. data:: collStats.userFlags

.. versionadded:: 2.2

Reports the flags on this collection set by the user. In version
2.2 the only user flag is :collflag:`usePowerOf2Sizes`.
If :collflag:`usePowerOf2Sizes` is enabled, :data:`~collStats.userFlags` will
be set to ``1``, otherwise :data:`~collStats.userFlags` will be ``0``.

See the :dbcommand:`collMod` command for more information on setting user
flags and :collflag:`usePowerOf2Sizes`.

.. data:: collStats.totalIndexSize

The total size of all indexes. The ``scale`` argument affects this
value.

.. data:: collStats.indexSizes

This field specifies the key and size of every existing index on
the collection. The ``scale`` argument affects this value.

Example
-------

The following is an example of :method:`db.collection.stats()` and
:dbcommand:`collStats` output:

.. code-block:: javascript

.. read-lock
{
"ns" : "<database>.<collection>",
"count" : <number>,
"size" : <number>,
"avgObjSize" : <number>,
"storageSize" : <number>,
"numExtents" : <number>,
"nindexes" : <number>,
"lastExtentSize" : <number>,
"paddingFactor" : <number>,
"systemFlags" : <bit>,
"userFlags" : <bit>,
"totalIndexSize" : <number>,
"indexSizes" : {
"_id_" : <number>,
"a_1" : <number>
},
"ok" : 1
}
2 changes: 1 addition & 1 deletion source/reference/method/db.collection.stats.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ db.collection.stats()

db.people.stats()

.. seealso:: ":doc:`/reference/collection-statistics`" for an
.. seealso:: :doc:`/reference/command/collStats` for an
overview of the output of this command.
2 changes: 1 addition & 1 deletion source/reference/method/db.printCollectionStats.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ db.printCollectionStats()
.. include:: /includes/note-method-does-not-return-json.rst


.. seealso:: ":doc:`/reference/collection-statistics`"
.. seealso:: :doc:`/reference/command/collStats`
2 changes: 1 addition & 1 deletion source/reference/mongostat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ UNIX/Linux file system utility ``vmstat``, but provides data regarding
- :doc:`/reference/command/serverStatus`
- :doc:`/reference/replica-status`
- :doc:`/reference/database-statistics`
- :doc:`/reference/collection-statistics`
- :doc:`/reference/command/collStats`

For an additional utility that provides MongoDB metrics see
":doc:`mongotop </reference/mongotop>`."
Expand Down
Loading