- Reference >
- JavaScript Methods >
- db.collection.stats()
db.collection.stats()¶
-
db.collection.
stats
(scale)¶ Parameters: - scale – Optional. Specifies the scale to deliver results. Unless specified, this command returns all sizes in bytes.
Returns: A document containing statistics that reflecting the state of the specified collection.
This function provides a wrapper around the database command
collStats
. Thescale
option allows you to configure how themongo
shell scales the sizes of things in the output. For example, specify ascale
value of1024
to display kilobytes rather than bytes.Call the
db.collection.stats()
method on a collection object, to return statistics regarding that collection. For example, the following operation returns stats on thepeople
collection:See also
“Collection Statistics Reference” for an overview of the output of this command.