- Reference >
mongo
Shell Methods >- Sharding Methods >
- sh.balancerCollectionStatus()
sh.balancerCollectionStatus()¶
On this page
Definition¶
-
sh.
balancerCollectionStatus
(namespace)¶ New in version 4.4.
Returns a document that contains information about whether the chunks of a sharded collection are balanced (i.e. do not need to be moved) as of the time the command is run or need to be moved because of draining shards, zone violation or imbalance of chunks across shards.
The
mongo
shell methodsh.balancerCollectionStatus()
wraps thebalancerCollectionStatus
command.
Syntax¶
The sh.balancerCollectionStatus
has the following form:
Parameter¶
The sh.balancerCollectionStatus()
method takes the following parameter:
Parameter | Type | Description |
---|---|---|
namespace | String | The of the collection to shard in the form
|
Access Control¶
When running with access control, the user must have the
enableSharding
privilege actions on database
and/or collection to run the
method. That is, a user must have a role that grants the
following privilege:
The built-in clusterManager
role provides the appropriate
privileges.
Example¶
To check whether the chunks of a sharded collection test.contacts
is currently in balance, connect to a mongos
instance
and issue the following:
If the chunks for the collection do not need to be moved, the method returns an output similar to the following:
For the description of the output, see balancerCollectionStatus Output.