Returns statistics that reflect the use state of a single database.

The db.stats() method has the following parameter:

Parameter Type Description
scale number Optional. The scale at which to deliver results. Unless specified, this command returns all data in bytes.
Returns:A document with statistics reflecting the database system’s state. For an explanation of the output, see dbStats.

The db.stats() method is a wrapper around the dbStats database command.


For MongoDB instances using the WiredTiger storage engine, after an unclean shutdown, statistics on size and count may off by up to 1000 documents as reported by collStats, dbStats, count. To restore the correct statistics for the collection, run validate on the collection.


The following example converts the returned values to kilobytes:



The scale factor rounds values to whole numbers.

Was this page helpful?

Yes No

Thank you for your feedback!

We're sorry! You can Report a Problem to help us improve this page.