OPTIONS

db.collection.stats()

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 containing statistics that reflecting the state of 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.