Schema Design Patterns and Antipatterns / Identify Antipatterns

Code Summary: Bloated Documents

To retrieve the number of documents in a collection using the stats() method in mongosh, use the following:

db.collection.stats().count

To retrieve the average size of documents in a collection using the stats() method in mongosh, use the following:

db.collection.stats().avgObjSize