Docs Menu

Docs HomeDevelop ApplicationsMongoDB Manual

commitReshardCollection

On this page

  • Definition
  • Example
commitReshardCollection

New in version 5.0.

During a resharding operation, MongoDB does not block writes until the estimated duration to complete the resharding operation is below two seconds.

If the current estimate is above two seconds but the time frame is acceptable to you, you can finish resharding faster. The commitReshardCollection command blocks writes early and forces the resharding operation to complete.

The command has the following syntax:

{
commitReshardCollection: "<database>.<collection>"
}

The mongosh provides a wrapper method sh.commitReshardCollection().

The following command forces the resharding operation on the sales.orders to block writes and complete:

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

Tip

See also:

←  cleanupReshardCollectionconfigureCollectionBalancing →

On this page