定义
MongoDB\Model\CollectionInfo::isCapped()Return whether the collection is a capped collection.
function isCapped(): boolean
Return Values
一个布尔值,表示该集合是否为固定大小集合。
示例
$db = (new MongoDB\Client)->test; // Creates a capped collection $db->createCollection( 'myCappedCollection', ['capped' => true, 'size' => 1048576] ); // Retrieves whether the collection is capped foreach ($db->listCollections(['filter' => ['name' => 'myCappedCollection']]) as $info) { var_dump($info->isCapped()); }
而输出将类似如下所示:
bool(true)
另请参阅
Capped Collections in the MongoDB manual
listCollections command reference in the MongoDB manual