Docs Menu
Docs Home
/ / /
PHP Library Manual
/ / /

MongoDB\Model\CollectionInfo::getCappedSize()

On this page

  • Definition
  • Return Values
  • Examples
  • See Also

Deprecated since version 1.9.

MongoDB\Model\CollectionInfo::getCappedSize()

Return the size limit for the capped collection in bytes. This correlates with the size option for MongoDB\Database::createCollection().

function getCappedSize(): integer|null

The size limit for the capped collection in bytes. If the collection is not capped, null will be returned.

This method is deprecated in favor of using MongoDB\Model\CollectionInfo::getOptions() and accessing the size key.

<?php
$info = new CollectionInfo([
'name' => 'foo',
'options' => [
'capped' => true,
'size' => 1048576,
]
]);
var_dump($info->getCappedSize());

The output would then resemble:

int(1048576)
  • MongoDB\Model\CollectionInfo::getCappedMax()

  • MongoDB\Model\CollectionInfo::isCapped()

  • MongoDB\Database::createCollection()

  • Capped Collections in the MongoDB manual

  • listCollections command reference in the MongoDB manual

← MongoDB\Model\CollectionInfo::getCappedMax()