定义
abortRewriteCollection停止正在进行的
rewriteCollection操作。8.3版本新增。
兼容性
此命令可用于以下环境中托管的部署:
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
注意
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
语法
db.adminCommand( { abortRewriteCollection: "<database>.<collection>" } )
命令字段
该命令采用以下字段:
字段 | 类型 | 必要性 | 说明 |
|---|---|---|---|
| 字符串 | 必需 | 指定要停止重写的数据库和集合。 |
访问控制
abortRewriteCollection 命令需要对要停止重写的集群或数据库和集合执行 rewriteCollection 权限操作。
具有以下角色的用户也可以执行此权限操作:
示例
考虑以下集合重写示例:
db.adminCommand( { rewriteCollection: "sales.orders" } )
要停止此重写,请将数据库和集合名称传递给 abortRewriteCollection 命令:
db.adminCommand( { abortRewriteCollection: "sales.orders" } )