文档菜单
文档首页
/ / /
PHP库手册
/ / /

MongoDB\Model\IndexInfo::isUnique()

本页内容

  • 定义
  • 返回值
  • 示例
  • 另请参阅
MongoDB\Model\IndexInfo::isUnique()

返回索引是否是唯一索引。这对应于 MongoDB\Collection::createIndex() 的 unique 选项.

function isUnique(): boolean

一个布尔值,表示索引是否是唯一索引。

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

输出结果将类似于

bool(true)
  • listIndexes 命令参考,请参阅 MongoDB 手册

  • 唯一索引,请参阅 MongoDB 手册

返回

isTtl()