View database statistics: db.stats ()
> use test switched to DB Test > Db.stats () { "DB" : "Test", "collections": 6, , "Objects": 3149516, "avgobjsize": 71.99159362898935, , "datasize": 226738676 , "storagesize": 377942016, "numextents": +, "Indexes": 5, "indexsize": 102535216, "FileSize": 2080374784, "NSSIZEMB": "Datafileversion" : { ' major ': 4, "Minor": 6 }, "OK": 1 } |
Note: The return value is interpreted as follows:
"DB": Database name
"Collections": Number of collections
"Objects": Number of documents
"Avgobjsize": Average size of each document
"DataSize": Data footprint, excluding index, in bytes
"Storagesize": Allocated storage space, this value does not degrade when the collection or document is deleted
"Numextents": contiguous allocated blocks of data
"Indexes": Number of indexes
"Indexsize": Index occupy space size
"FileSize": the size of the physical storage file
"Nssizemb": namespace File Size
"Datafileversion": {
"Major": Data file Major version number
"Minor": Minor version number
},
Collection Statistics: db.collection.stats ()
> Db. User.stats () { "ns": "Test. User, "Count": 3149352, "size": 226727736, &NBS P "Avgobjsize": 71.9918688034872, "storagesize": 377905152, "numextents": +, "nindexes": 2, "Lastexten Tsize ": 104161280, " Paddingfactor ": 1.0000000000000004, " s Ystemflags ": 0, " UserFlags ": 0, " totalindexsize ": 1817443 "indexsizes": { "_id_": 10 2502512, "age_1": 79241792 }, "OK": 1 } |
Note: The return value is interpreted as follows:
"NS": namespace
"Count": Number of documents
' Size ': Data footprint in the collection, excluding indexes
"Avgobjsize": Average size of each document
"Storagesize": Allocated storage space, this value does not degrade when the document in the collection is deleted
"Numextents": contiguous allocated blocks of data
"Nindexes": Number of indexes
"Lastextentsize": the size of the most recently allocated block
"Paddingfactor": Fill factor
"Systemflags": Unknown
"UserFlags": Unknown
"Totalindexsize": Index occupies total space size
"Indexsizes": {
"_ID_": ID column index occupies space size
"Age_1": Age column occupies space size
},
from:http://blog.csdn.net/seteor/article/details/11601273
State information for MongoDB databases and collections