View storage and index metrics for a collection.

Section: Explain and tune

Inspect collection stats

javascript
javascript
db.runCommand({ collStats: "orders" })
Explanation

Useful for checking total size, avg document size, and index footprint.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Explain and tune
Explain a query
Show the execution plan for a `find()` query.
OpenIn sheetjavascriptsame section
Force a specific index with hint
Test how a query behaves with a chosen index.
OpenIn sheetjavascriptsame section
Hide an index for testing
Temporarily hide an index from the planner.
OpenIn sheetjavascriptsame section
Drop an index
Remove an unneeded index.
OpenIn sheetjavascriptsame section
Create a single-field index
Index one frequently filtered field.
OpenIn sheetjavascript1 tag match
Create a compound index
Index fields used together in filters or sorts.
OpenIn sheetjavascript1 tag match