- Reference >
- Database Commands >
- dbStats
dbStats¶
-
dbStats
¶ The
dbStats
command returns storage statistics for a given database. The command takes the following syntax:The value of the argument (e.g.
1
above) todbStats
does not affect the output of the command. Thescale
option allows you to specify how to scale byte values. For example, ascale
value of1024
will display the results in kilobytes rather than in bytes.The time required to run the command depends on the total size of the database. Because the command has to touch all data files, the command may take several seconds to run.
In the
mongo
shell, thedb.stats()
function provides a wrapper around this functionality. See the “Database Statistics Reference” document for an overview of this output.