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

MongoDB\Model\CollectionInfo::getCappedMax()

MongoDB\Model\CollectionInfo::getCappedMax()

Cappedコレクションのドキュメント制限を返します。 これは、MongoDB\Database::createCollection() のmaxオプションと相関します

function getCappedMax(): integer|null

Capped コレクションのドキュメント数。 コレクションに上限が設けられていない場合は、 nullが返されます。

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

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

int(100)