Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of PHP Library Manual, refer to the upgrade documentation.

MongoDB\Model\CollectionInfo::getCappedSize()

Definition

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

Return Values

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

Examples

<?php

$info = new CollectionInfo([
    'name' => 'foo',
    'options' => [
        'capped' => true,
        'size' => 1048576,
    ]
]);

var_dump($info->getCappedSize());

The output would then resemble:

int(1048576)