定义
兼容性
此命令可用于以下环境中托管的部署:
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
语法
该命令具有以下语法:
db.adminCommand( { setAllowMigrations: "<db>.<collection>", allowMigrations: <true|false> } )
命令字段
该命令采用以下参数:
行为
setAllowMigrations requires the same privileges as moveChunk.
例子
此操作会阻止在store.inventorycollection上的迁移:
db.adminCommand( { setAllowMigrations: "store.inventory", allowMigrations: false } )