Database Manual / Reference / Database Commands / Sharding

cleanupReshardCollection (database command数据库命令)

Definition定义

cleanupReshardCollection

New in version 5.0.在版本5.0中新增。

The cleanupReshardCollection command cleans up metadata of a failed resharding operation. You only need to run this command if a primary failover occurred while you ran a resharding operation.cleanupRehardCollection命令用于清理失败的重新分片操作的元数据。只有在运行重新标记操作时发生主故障转移时,才需要运行此命令。

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(
{
cleanupReshardCollection: "<database>.<collection>"
}
)

Example示例

Clean up a Failed Resharding Operation清理失败的重新装裱操作

The following example cleans up metadata of a failed resharding operation on the sales.orders collection:以下示例清理sales.orders集合上失败的重新分片操作的元数据:

db.adminCommand({
cleanupReshardCollection: "sales.orders"
})