sh.enableBalancing()

Description

  • sh.enableBalancing(namespace)
  • Enables the balancer for the specified namespace of the sharded collection.

Important

You can only run sh.enableBalancing() on amongos instance. sh.enableBalancing()errors if run on mongod instance.

The sh.enableBalancing() method has the following parameter:

ParameterTypeDescriptionnamespacestringThe namespace of the collection.

Important

sh.enableBalancing() does not _start_balancing. Rather, it allows balancing of this collection thenext time the balancer runs.

For more information on the balancing process, seeManage Sharded Cluster Balancer andSharded Cluster Balancer.