Navigation
This version has reached end of life on October 2016. Learn more about upgrading your version of MongoDB.

db.collection.stats()

On this page

Definition

db.collection.stats(scale)

Returns statistics about the collection. The method includes the following parameter:

Parameter Type Description
scale number Optional. The scale used in the output to display the sizes of items. By default, output displays sizes in bytes. To display kilobytes rather than bytes, specify a scale value of 1024.
Returns:A document that contains statistics on the specified collection.

The stats() method provides a wrapper around the database command collStats.

Example

The following operation returns stats on the people collection:

db.people.stats()

See also

collStats for an overview of the output of this command.