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

MongoDB\Model\IndexInfo::isUnique()

On this page

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

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

function isUnique(): boolean

A boolean indicating whether the index is a unique index.

<?php
$info = new IndexInfo([
'unique' => true,
]);
var_dump($info->isUnique());

The output would then resemble:

bool(true)

Back

isTtl()