storageSize() – Return the total amount of storage in bytes for the collection command

Returns the total amount of storage in bytes for the collection.

Syntax diagram

Read syntax diagramSkip visual syntax diagramdb.collection. storageSize()

Command parameters

query
Does not take a query filter.

Example

The following example shows the command syntax for returning the total amount of storage in bytes for the collection, members:
db.members.storageSize()
The following example shows a returned value from running the storageSize command:
2939