totalSize() –Return the total size, in bytes, of all data in a collection and every index on the collection command
Returns the total size, in bytes, of all data in a collection and the size of every index on a collection.
Syntax diagram
Command parameters
- query
- Does not take a query filter.
Example
The following example shows the command syntax for returning the total size, in bytes, of all
data in the collection,
members, as well as the size of all indexes on the
collection:db.members.totalSize()The following example shows a returned value
from running the totalSize command:3957