定义
abortReshardCollection版本 5.0 中的新增功能。
During a resharding operation, you can abort the operation with the
abortReshardCollectioncommand.You can abort a resharding operation at any point until the commit phase. If the resharding operation has reached the commit phase before you run the
abortReshardCollectioncommand, the command returns an error.提示
In
mongosh, this command can also be run through thesh.abortReshardCollection()helper method.Helper methods are convenient for
mongoshusers, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.
兼容性
此命令可用于以下环境中托管的部署:
- MongoDB Atlas:用于云中 MongoDB 部署的完全托管服务
注意
所有 MongoDB Atlas 集群都支持此命令。有关 Atlas 对所有命令的支持的信息,请参阅不支持的命令。
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
语法
该命令具有以下语法:
db.adminCommand( { abortReshardCollection: "<database>.<collection>" } )
例子
中止重新分片操作
以下示例中止对sales.orders集合正在运行的重新分片操作:
db.adminCommand({ abortReshardCollection: "sales.orders" })
提示