Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/ / /
PHP Library Manual
/ / /

MongoDB\Model\IndexInfo::isUnique()

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()

On this page