定义
MongoDB\Model\CollectionInfo::isCapped()返回该集合是否为固定大小固定大小集合。
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 cappedforeach ($db->listCollections(['filter' => ['name' => 'myCappedCollection']]) as $info) { var_dump($info->isCapped());}而输出将类似如下所示:
bool(true)另请参阅
MongoDB 手册中的固定大小集合
MongoDB 手册中的listCollections命令参考