setAllowMigrations
Definition
setAllowMigrations
Prevents the start of new automatic migrations on a collection, prevents in-flight range migrations (started manually or by the balancer) from committing, and excludes the collection from new balancer rounds.
Compatibility
This command 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 serverless instances. 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
Syntax
The command has the following syntax:
db.adminCommand( { setAllowMigrations: "<db>.<collection>", allowMigrations: <true|false> } )
Command Fields
The command takes the following parameters:
Field | Type | Description |
---|---|---|
| The collection to modify. | |
| If
If
|
Behavior
setAllowMigrations
requires the same privileges as
moveChunk
.
Example
This operation prevents migrations on the store.inventory
collection:
db.adminCommand( { setAllowMigrations: "store.inventory", allowMigrations: false } )