- Reference >
mongoShell Methods >- Collection Methods >
- db.collection.indexStats()
db.collection.indexStats()¶
On this page
Definition¶
-
db.collection.indexStats(index)¶ Aggregates statistics for the B-tree data structure that stores data for a MongoDB index. The
indexStats()method is a thin wrapper around theindexStatscommand. TheindexStats()method is available only onmongodinstances running with the--enableExperimentalIndexStatsCmdoption.Important
The
indexStats()method is not intended for production deployments.The
indexStats()method has the following form:The
indexStats()method has the following parameter:Parameter Type Description indexdocument The index name. The method takes a read lock and pages into memory all the extents, or B-tree buckets, encountered. The method might be slow for large indexes if the underlying extents are not already in physical memory. Do not run
indexStats()on a replica set primary. When run on a secondary, the command causes the secondary to fall behind on replication.The method aggregates statistics for the entire B-tree and for each individual level of the B-tree. For a description of the command’s output, see indexStats.
For more information about running
indexStats(), see https://github.com/mongodb-labs/storage-viz#readme.