mongodb的db.stats

glc-test:PRIMARY>  db.stats()
{
        "db" : "eagle",
        "collections" : 9,
        "views" : 0,
        "objects" : 97609717,
        "avgObjSize" : 1081.2369183797553,
        "dataSize" : 105539229613,
        "storageSize" : 40286806016,
        "numExtents" : 0,
        "indexes" : 32,
        "indexSize" : 8504152064,
        "fsUsedSize" : 2066056126464,
        "fsTotalSize" : 2797758251008,
        "ok" : 1,
        "operationTime" : Timestamp(1606379817, 1),
        "$clusterTime" : {
                "clusterTime" : Timestamp(1606379817, 1),
                "signature" : {
                        "hash" : BinData(0,"6PcBNtC1REHC2tcgLx+UaD2oVww="),
                        "keyId" : NumberLong("6856584343653974019")
                }
        }
}
glc-test:PRIMARY> show dbs
admin          0.000GB
ai_open_caps   0.000GB
apple          0.045GB
config         0.000GB
eagle         45.440GB
gallery        3.234GB
google         0.000GB
local         39.088GB
pbm            0.000GB
test           0.000GB
glc-test:PRIMARY> 105539229613/1024/1024/1024
98.29106704611331
glc-test:PRIMARY> 40286806016/1024/1024/1024
37.52001190185547
glc-test:PRIMARY> 8504152064/1024/1024/1024
7.920108795166016
glc-test:PRIMARY> 

数据大小约为:storageSize

索引占用大小约为:indexSize

当前数据库:eagle

当前数据库的集合个数:collections

当前数据库所有集合的行数:objects

#############################################

原文地址:https://www.cnblogs.com/igoodful/p/14043097.html