dbStats is a MongoDB command for inspecting a database’s size, data usage, index usage, and storage efficiency. It supports operational monitoring and helps identify opportunities for storage or performance optimization. section 21.2.3
Use dbStats when you need to:
- Review database-level resource use and storage efficiency. section 21.2.3
- Support decisions about indexing, sharding, and other database optimizations alongside workload and collection diagnostics. section 21.2.3
- Pair database-wide statistics with collStats for document counts, collection data size, index counts, and collection-level performance details. section 21.2.3
Run dbStats
Execute `db.runCommand({ dbStats: 1 })` to retrieve statistics for the current database. Use the result with other native diagnostic commands when investigating resource use or potential bottlenecks. section 21.2.3
db.runCommand({ dbStats: 1 })
Copyable shell syntax for requesting database statistics. section 21.2.3
