This version of the documentation is archived and no longer supported.




mongo Shell Method

This page documents a mongo method. This is not the documentation for database commands or language-specific drivers, such as Node.js. To use the database command, see the size field returned by the collStats command.

For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.

Returns:The size in bytes of the collection.

Data compression does not affect this value.

This method provides a wrapper around the size output of the collStats (i.e. db.collection.stats()) command.