Docs HomeMongoDB Manual

setAllowMigrations

On this page本页内容

Definition

setAllowMigrations

Prevents the start of new automatic migrations on a collection, prevents in-flight manual migrations from committing, and excludes the collection from new balancer rounds.

Syntax

The command has the following syntax:

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

Command Fields

The command takes the following parameters:

FieldTypeDescription
setAllowMigrationsstringThe collection to modify.
allowMigrationsbooleanIf false: If true:

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
} )