AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。

MongoDB\Model\CollectionInfo::getCappedSize()

MongoDB\Model\CollectionInfo::getCappedSize()

Capped コレクション のサイズ制限をバイト単位で返します。 これは、MongoDB\Database::createCollection() のsizeオプションと相関します

function getCappedSize(): integer|null

上限付きコレクション のサイズ制限(バイト単位)。 コレクションに上限が設けられていない場合は、 nullが返されます。

<?php $db = (new MongoDB\Client)->test; // Creates a capped collection with a size of 1048576$db->createCollection( 'myCappedCollection', ['capped' => true, 'size' => 1048576]); // Retrieves the size limit for the capped collectionforeach ($db->listCollections(['filter' => ['name' => 'myCappedCollection']]) as $info) { var_dump($info->getCappedSize());}

出力は次のようになります。

int(1048576)