sh.commitReshardCollection()

On this page本页内容

Definition定义

sh.commitReshardCollection(namespace)

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

During a resharding operation, MongoDB does not block writes until the estimated duration to complete the resharding operation is below two seconds.在重新存储操作期间,MongoDB不会阻止写操作,直到完成重新存储操作的估计持续时间低于两秒

If the current estimate is above two seconds but the time frame is acceptable to you, you can finish resharding faster. 如果当前估计值超过两秒,但您可以接受时间范围,则可以更快地完成重新装载。The sh.commitReshardCollection() method blocks writes early and forces the resharding operation to complete.sh.commitReshardCollection()方法会阻止提前写入,并强制完成重新存储操作。

The mongosh method sh.commitReshardCollection() wraps the commitReshardCollection command.mongosh方法sh.commitReshardCollection()包装了commitReshardCollection命令。

Syntax语法

The sh.commitReshardCollection() method has the following syntax:sh.commitReshardCollection()方法具有以下语法:

sh.commitReshardCollection( <namespace> )

Parameter参数

The sh.commitReshardCollection() method takes the following parameter:sh.commitReshardCollection()方法采用以下参数:

Parameter参数Type类型Description描述
namespaceString

The name of the collection to shard in the form "<database>.<collection>".要分片的集合的名称,格式为"<database>.<collection>"

Example示例

Commit a Resharding Operation提交重新硬化操作

The following command forces the resharding operation on the sales.orders to block writes and complete:以下命令强制sales.orders上的重新分片操作阻止写入并完成:

sh.commitReshardCollection("sales.orders")
Tip提示
See also: 参阅:
←  sh.balancerCollectionStatus()sh.disableBalancing() →