定義
commitReshardCollectionバージョン 5.0 の新機能。
commitReshardCollectionは書込みを早期にブロックし、リシャーディング操作を強制的に完了させます。リシャーディング操作中、 MongoDB はリシャーディング操作を完了するための推定期間が一定の値を下回るまで、書込みをブロックしません。MongoDB 8.0.12 以前では、この値は 2 秒です。MongoDB 8.0.13 以降では、この値は 500 ミリ秒です。
現在の推定期間がしきい値を超えているが、時間枠が許容できる場合は、
commitReshardCollectionを呼び出すとリシャーディングをより速く完了できます。これにより、書込みが早期にブロックされ、リシャーディング操作が強制的に完了します。Tip
In
mongosh, this command can also be run through thesh.commitReshardCollection()helper method.Helper methods are convenient for
mongoshusers, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
注意
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
構文
このコマンドの構文は、次のとおりです。
db.adminCommand( { commitReshardCollection: "<database>.<collection>" } )
The mongosh provides a wrapper method sh.commitReshardCollection().
例
リシャーディング操作のコミット
次のコマンドは、 sales.ordersにリシャーディング操作を強制し、書込みをブロックして完了します。
db.adminCommand({ commitReshardCollection: "sales.orders" })