Docs Menu
Docs Home
/
Database Manual
/ / /

setAllowMigrations (database command)

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.

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

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

The command has the following syntax:

db.adminCommand(
{
setAllowMigrations: "<db>.<collection>",
allowMigrations: <true|false>
}
)

The command takes the following parameters:

Field
Type
Description

string

The collection to modify.

boolean

If false:

If true:

setAllowMigrations requires the same privileges as moveChunk.

This operation prevents migrations on the store.inventory collection:

db.adminCommand( {
setAllowMigrations: "store.inventory",
allowMigrations: false
} )

Back

reshardCollection

On this page