MongoDB: db.collection.getShardDistribution() method
db.collection.getShardDistribution
The db.collection.getShardDistribution() method is used for collections in sharded clusters, db.collection.getShardDistribution() reports data of chunk distribution.
Syntax:
db.collection.getShardDistribution()
Returns:
Prints the data distribution statistics for a sharded collection. You must call the getShardDistribution() method on a sharded collection
Retrieve the restaurants data from here
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.
- <estDataPercent-x> is a calculated value that reflects, for each shard, the data size as the percentage of the collections total data size.
- <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
- stats.shards[ <shard-x> ].avgObjSize is a number that reflects the average object size, including the unit of measure, for the shard.
Previous:
db.collection.getIndexes() method
Next:
db.collection. getShardVersion() method
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/mongodb/shell-methods/collection/db-collection-getShardDistribution.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics