- Reference >
mongosh
Methods >- Sharding Methods >
- sh.commitReshardCollection()
sh.commitReshardCollection()¶
On this page
Definition¶
-
sh.
commitReshardCollection
(namespace)¶ 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
sh.commitReshardCollection()
method blocks writes early and forces the resharding operation to complete.The
mongosh
methodsh.commitReshardCollection()
wraps thecommitReshardCollection
command.
Syntax¶
The sh.commitReshardCollection()
method has the following
syntax:
Parameter¶
The sh.commitReshardCollection()
method takes the following
parameter:
Parameter | Type | Description |
---|---|---|
namespace | String | The name of the collection to shard in the form
|
Example¶
Commit a Resharding Operation¶
The following command forces the resharding operation on the sales.orders
to block writes and
complete:
See also