Docs Menu
Docs Home
/
Database Manual
/ / /

balancerStart (database command)

balancerStart

Starts the balancer thread. The command does not wait for a balancing round to start.

Starting in MongoDB 7.0, starting the balancer also enables the AutoMerger for the sharded cluster.

Tip

In mongosh, this command can also be run through the sh.startBalancer() helper method.

Helper methods are convenient for mongosh users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.

This command is available in deployments hosted in the following environments:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

You can only issue the balancerStart against the admin database on a mongos instance.

The command has the following syntax:

db.adminCommand(
{
balancerStart: 1,
maxTimeMS: <number>
}
)
Field
Type
Description

balancerStart

any

Any value.

maxTimeMS

integer

Optional. Time limit for enabling the balancer.

Defaults to 60000 milliseconds.

To start the balancer thread, connect to a mongos instance and issue the following command:

db.adminCommand( { balancerStart: 1 } )

Back

balancerCollectionStatus

On this page