setAllowMigrations
定义
兼容性
此命令在以下环境中托管部署中可用
MongoDB Atlas:面向云中MongoDB部署的完全托管服务
重要
此命令不支持在无服务器实例中。有关更多信息,请参阅不支持命令。
MongoDB Enterprise:MongoDB的基于订阅的自托管版本
MongoDB Community:MongoDB的开源、免费使用和自托管版本
语法
该命令有以下语法
db.adminCommand( { setAllowMigrations: "<db>.<collection>", allowMigrations: <true|false> } )
命令字段
该命令接受以下参数
字段 | 类型 | 描述 |
---|---|---|
字符串 | 要修改的集合。 | |
布尔值 |
行为
setAllowMigrations
需要和 moveChunk
相同的权限。
示例
此操作阻止在 store.inventory
集合上执行迁移。
db.adminCommand( { setAllowMigrations: "store.inventory", allowMigrations: false } )