バージョン 1.9 以降非推奨。
定義
MongoDB\Model\CollectionInfo::getCappedMax()
Capped コレクションのドキュメント制限を返します。 これは、
MongoDB\Database::createCollection()
のmax
オプションと相関します。function getCappedMax(): integer|null
Return Values
Capped コレクションのドキュメント数。 コレクションに上限が設けられていない場合は、 null
が返されます。
このメソッドは非推奨となり、代わりにMongoDB\Model\CollectionInfo::getOptions()
を使用し、 max
キーにアクセスします。
例
$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 collection foreach ($db->listCollections(['filter' => ['name' => 'myCappedCollection']]) as $info) { var_dump($info->getCappedMax()); }
出力は次のようになります。
int(100)