MongoDB\Model\IndexInfo::isUnique()
On this page
Definition
MongoDB\Model\IndexInfo::isUnique()
Return whether the index is a unique index. This correlates with the
unique
option forMongoDB\Collection::createIndex()
.function isUnique(): boolean
Return Values
A boolean indicating whether the index is a unique index.
Examples
$info = new IndexInfo([ 'unique' => true, ]); var_dump($info->isUnique());
The output would then resemble:
bool(true)
See Also
listIndexes command reference in the MongoDB manual
Unique Indexes in the MongoDB manual