stats()

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Indexes and aggregation

What it does

Returns collection storage and index statistics.

Syntax

db.collection.stats()

Use case

Investigate growth and storage footprint.

stats(): practical example
db.orders.stats()
💡 Explanation Returns collection storage and index statistics. When to use it Investigate growth and storage footprint.
Key Takeaways
  • Returns collection storage and index statistics.
  • Typical use: Investigate growth and storage footprint.