Definition
sh.enableMigrations(namespace)Enables migrations for the specified namespace of the sharded collection, but does not start chunk migrations. The balancer includes the collection you pass to
sh.enableMigrations()in migration operations the next time it runs. For more information on chunk migrations, see Manage Sharded Cluster Balancer.Important
You can only run
sh.enableMigrations()on amongosinstance. If you runsh.enableMigrations()on amongodinstance, the method returns an error.The
sh.enableMigrations()method has the following parameter:ParameterTypeDescriptionnamespacestring
The namespace of the collection.
Compatibility
This method is available in deployments hosted in the following environments:
MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB
Note
You can verify migration status using sh.status(), which displays
the allowMigrations field for each collection.