- Reference >
mongoShell Methods >- Collection Methods >
- db.collection.dataSize()
db.collection.dataSize()¶
-
db.collection.dataSize()¶ Important
mongoShell MethodThis page documents a
mongomethod. This is not the documentation for database commands or language-specific drivers, such as Node.js. To use the database command, see thesizefield returned by thecollStatscommand.For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.
Returns: The size in bytes of the collection. Data compressiondoes not affect this value.This method provides a wrapper around the
sizeoutput of thecollStats(i.e.db.collection.stats()) command.