sh.enableBalancing()
On this page
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 onmongod
instance.The
sh.enableBalancing()
method has the following parameter:ParameterTypeDescriptionnamespace
stringThe namespace of the collection.Important
sh.enableBalancing()
does not start balancing. Rather, it allows balancing of this collection the next time the balancer runs.For more information on the balancing process, see Manage Sharded Cluster Balancer and Sharded Cluster Balancer.
Compatibility
This method is available in deployments hosted in the following environments:
MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
Important
This command is not supported in M0, M2, and M5 clusters. For more information, see Unsupported Commands.
MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB