Definition定义
abortReshardCollectionNew in version 5.0.在版本5.0中新增。During a resharding operation, you can abort the operation with the在重新分片操作期间,您可以使用abortReshardCollectioncommand.abortReshardCollection命令中止该操作。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.abortReshardCollection命令之前,重新标记操作已经到达提交阶段,则该命令将返回错误。Tip
In在mongosh, this command can also be run through thesh.abortReshardCollection()helper method.mongosh中,此命令也可以通过sh.abortReshardCollection()辅助方法运行。Helper methods are convenient for助手方法对mongoshusers, but they may not return the same level of information as database commands.mongosh用户来说很方便,但它们可能不会返回与数据库命令相同级别的信息。In cases where the convenience is not needed or the additional return fields are required, use the database command.如果不需要便利性或需要额外的返回字段,请使用database命令。
Compatibility兼容性
This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:
- MongoDB Atlas
: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务
Note
This command is supported in all MongoDB Atlas clusters. 所有MongoDB Atlas集群都支持此命令。For information on Atlas support for all commands, see Unsupported Commands.有关Atlas支持所有命令的信息,请参阅不支持的命令。
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Syntax语法
The command has the following syntax:该命令具有以下语法:
db.adminCommand(
{
abortReshardCollection: "<database>.<collection>"
}
)Example示例
Abort a Resharding Operation中止重新装载操作
The following example aborts a running resharding operation on the 以下示例中止了sales.orders collection:sales.orders集合上正在运行的重新分片操作:
db.adminCommand({
abortReshardCollection: "sales.orders"
})