发布于 2015-09-14 15:10:31 | 228 次阅读 | 评论: 0 | 来源: 网络整理

collStats

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.

也可以参考

集合统计.”

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务