Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/ / /
PHP 라이브러리 매뉴얼
/ / /

MongoDB\Model\CollectionInfo::getCappedMax()

버전 1.9부터 더 이상 사용되지 않습니다.

MongoDB\Model\CollectionInfo::getCappedMax()

고정 사이즈 컬렉션 에 대한 문서 제한을 반환합니다. 이는 MongoDB\Database::createCollection()에 대한 max 옵션과 상관 관계가 있습니다.

function getCappedMax(): integer|null

고정 사이즈 컬렉션 의 문서 제한입니다. 컬렉션 에 제한이 없으면 null 이(가) 반환됩니다.

이 메서드는 MongoDB\Model\CollectionInfo::getOptions() 를 사용하고 max 키에 액세스하는 방식으로 더 이상 사용되지 않습니다.

<?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 collection
foreach ($db->listCollections(['filter' => ['name' => 'myCappedCollection']]) as $info) {
var_dump($info->getCappedMax());
}

이 경우 출력은 다음과 유사합니다:

int(100)
  • MongoDB\Model\CollectionInfo::getCappedSize()

  • MongoDB\Model\CollectionInfo::isCapped()

  • MongoDB\Database::createCollection()

  • MongoDB 매뉴얼의 고정 사이즈 컬렉션

  • MongoDB 매뉴얼의 listCollections 명령 참조

돌아가기

CollectionInfo

이 페이지의 내용