db.collection.dataSize()

  • db.collection.dataSize()

mongo Shell Method

This page documents the mongo shell method, and doesnot refer to the MongoDB Node.js driver (or any other driver)method. For corresponding MongoDB driver API, refer to your specificMongoDB driver documentation instead.

Returns:The size in bytes of the collection.Data compression does not affectthis value.

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