发布于 2015-09-14 15:10:31 | 240 次阅读 | 评论: 0 | 来源: 网络整理
The collStats command returns a variety of storage statistics for a given collection. Use the following syntax:
{ collStats: "collection" , scale : 1024 }
Specify the collection you want statistics for, and use the scale argument to scale the output. The above example will display values in kilobytes.
Examine the following example output, which uses the db.collection.stats() helper in the mongo shell.
> db.users.stats()
{
"ns" : "app.users", // namespace
"count" : 9, // number of documents
"size" : 432, // collection size in bytes
"avgObjSize" : 48, // average object size in bytes
"storageSize" : 3840, // (pre)allocated space for the collection
"numExtents" : 1, // number of extents (contiguously allocated chunks of datafile space)
"nindexes" : 2, // number of indexes
"lastExtentSize" : 3840, // size of the most recently created extent
"paddingFactor" : 1, // padding can speed up updates if documents grow
"flags" : 1,
"totalIndexSize" : 16384, // total index size in bytes
"indexSizes" : { // size of specific indexes in bytes
"_id_" : 8192,
"username" : 8192
},
"ok" : 1
}
注解
The scale factor rounds values to whole numbers. This can produce unpredictable and unexpected results in some situations.
也可以参考
“集合统计.”