This version of the documentation is archived and no longer supported.
  • Reference >
  • Collection Statistics Reference

Collection Statistics Reference


To fetch collection statistics, call the db.collection.stats() method on a collection object in the mongo shell:


You may also use the literal command format:

db.runCommand( { collStats: "collection" } )

Replace collection in both examples with the name of the collection you want statistics for. By default, the return values will appear in terms of bytes. You can, however, enter a scale argument. For example, you can convert the return values to kilobytes like so:



db.runCommand( { collStats: "collection", scale: 1024 } )


The scale argument rounds values to whole numbers. This can produce unpredictable and unexpected results in some situations.

See also

The documentation of the “collStats” command and the “db.collection.stats(),” method in the mongo shell.

Example Document

The output of db.collection.stats() resembles the following:

     "ns" : "<database>.<collection>",
     "count" : <number>,
     "size" : <number>,
     "avgObjSize" : <number>,
     "storageSize" : <number>,
     "numExtents" : <number>,
     "nindexes" : <number>,
     "lastExtentSize" : <number>,
     "paddingFactor" : <number>,
     "systemFlags" : <bit>,
     "userFlags" : <bit>,
     "totalIndexSize" : <number>,
     "indexSizes" : {
             "_id_" : <number>,
             "a_1" : <number>
     "ok" : 1



The namespace of the current collection, which follows the format [database].[collection].


The number of objects or documents in this collection.


The size of the data stored in this collection. This value does not include the size of any indexes associated with the collection, which the totalIndexSize field reports.

The scale argument affects this value.


The average size of an object in the collection. The scale argument affects this value.


The total amount of storage allocated to this collection for document storage. The scale argument affects this value. The storageSize does not decrease as you remove or shrink documents.


The total number of contiguously allocated data file regions.


The number of indexes on the collection. All collections have at least one index on the _id field.

Changed in version 2.2: Before 2.2, capped collections did not necessarily have an index on the _id field, and some capped collections created with pre-2.2 versions of mongod may not have an _id index.


The size of the last extent allocated. The scale argument affects this value.


The amount of space added to the end of each document at insert time. The document padding provides a small amount of extra space on disk to allow a document to grow slightly without needing to move the document. mongod automatically calculates this padding factor


Changed in version 2.2: Removed in version 2.2 and replaced with the userFlags and systemFlags fields.

Indicates the number of flags on the current collection. In version 2.0, the only flag notes the existence of an index on the _id field.


New in version 2.2.

Reports the flags on this collection that reflect internal server options. Typically this value is 1 and reflects the existence of an index on the _id field.


New in version 2.2.

Reports the flags on this collection set by the user. In version 2.2 the only user flag is usePowerOf2Sizes. If usePowerOf2Sizes is enabled, userFlags will be set to 1, otherwise userFlags will be 0.

See the collMod command for more information on setting user flags and usePowerOf2Sizes.


The total size of all indexes. The scale argument affects this value.


This field specifies the key and size of every existing index on the collection. The scale argument affects this value.