- Reference >
mongo
Shell Methods >- Collection Methods >
- db.collection.getShardDistribution()
db.collection.getShardDistribution()¶
On this page
Definition¶
-
db.collection.
getShardDistribution
()¶ mongo
Shell MethodThis page documents the
mongo
shell method, and does not refer to the MongoDB Node.js driver (or any other driver) method. For corresponding MongoDB driver API, refer to your specific MongoDB driver documentation instead.Prints the data distribution statistics for a sharded collection.
Tip
Before running the method, use the
flushRouterConfig
command to refresh the cached routing table to avoid returning stale distribution information for the collection. Once refreshed, rundb.collection.getShardDistribution()
for the collection you wish to build the index.For example:
See also
Output¶
Sample Output¶
The following is a sample output for the distribution of a sharded collection:
Output Fields¶
The output information displays:
<shard-x>
is a string that holds the shard name.<host-x>
is a string that holds the host name(s).<size-x>
is a number that includes the size of the data, including the unit of measure (e.g.b
,Mb
).<count-x>
is a number that reports the number of documents in the shard.<number of chunks-x>
is a number that reports the number of chunks in the shard.<size-x>/<number of chunks-x>
is a calculated value that reflects the estimated data size per chunk for the shard, including the unit of measure (e.g.b
,Mb
).<count-x>/<number of chunks-x>
is a calculated value that reflects the estimated number of documents per chunk for the shard.<stats.size>
is a value that reports the total size of the data in the sharded collection, including the unit of measure.<stats.count>
is a value that reports the total number of documents in the sharded collection.<calc total chunks>
is a calculated number that reports the number of chunks from all shards, for example:<estDataPercent-x>
is a calculated value that reflects, for each shard, the data size as the percentage of the collection’s total data size, for example:<estDocPercent-x>
is a calculated value that reflects, for each shard, the number of documents as the percentage of the total number of documents for the collection, for example:stats.shards[ <shard-x> ].avgObjSize
is a number that reflects the average object size, including the unit of measure, for the shard.