You are viewing an offline version of MongoDB documentation. Some page features might be unavailable. To view the latest version of the page or use interactive features, visit the live page.
MongoDB\Model\IndexInfo::isUnique()
Definition
MongoDB\Model\IndexInfo::isUnique()Return whether the index is a unique index. This correlates with the
uniqueoption 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