重要
mongosh メソッド
This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.
データベースコマンドについては、collStats コマンドによって返される storageSize フィールドを参照してください。
MongoDB API ドライバーについては、各言語の「MongoDB ドライバーのドキュメント」を参照してください。
定義
db.collection.storageSize()次の値を返します。 ドキュメント保存用にこのコレクションに割り当てられたストレージの合計量(バイト単位)。
コレクション データが圧縮されている場合(
default for WiredTiger)、ストレージ サイズは圧縮されたサイズを反映し、db.collection.dataSize(). によって返される値よりも小さくなる可能性があります。レプリカセット ノードで
collStats操作を実行するには、ノードがPRIMARYまたはSECONDARY状態である必要があります。 ノードがSTARTUP2などの別の状態にある場合、操作はエラーになります。
互換性
このメソッドは、次の環境でホストされている配置で使用できます。
- 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 のバージョン