For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

sh.disableMigrations() (mongosh method)

sh.disableMigrations(namespace)

Disables migrations for the specified namespace of the sharded collection. The balancer does not migrate chunks for the collection you pass to sh.disableMigrations() until migrations are re-enabled using sh.enableMigrations(). For more information on chunk migrations, see Manage Sharded Cluster Balancer.

Important

You can only run sh.disableMigrations() on a mongos instance. If you run sh.enableMigrations() on a mongod instance, the method returns an error.

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

Parameter
Type
Description

namespace

string

The namespace of the collection.

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

Note

You can verify migration status using sh.status(), which displays the allowMigrations field for each collection.