Docs Menu

Docs HomePHP Library Manual

MongoDB\Model\IndexInfo::isTtl()

On this page

  • Definition
  • Return Values
  • Examples
  • See Also
MongoDB\Model\IndexInfo::isTtl()

Return whether the index is a TTL index. This correlates with the expireAfterSeconds option for MongoDB\Collection::createIndex().

function isTtl(): boolean

A boolean indicating whether the index is a TTL index.

<?php
$info = new IndexInfo([
'expireAfterSeconds' => 100,
]);
var_dump($info->isTtl());

The output would then resemble:

bool(true)
← MongoDB\Model\IndexInfo::isText()