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

MongoDB\Model\IndexInfo::isText()

本页内容

  • 定义
  • 返回值
  • 示例
  • 另请参阅

在版本1.4.

MongoDB\Model\IndexInfo::isText()

返回索引是否为文本 索引。

function isText(): boolean

一个布尔值,指示索引是否为文本索引。

<?php
$collection = (new MongoDB\Client)->selectCollection('test', 'restaurants');
$collection->createIndex(['name' => 'text']);
foreach ($collection->listIndexes() as $index) {
if ($index->isText()) {
printf("%s has default language: %d\n", $index->getName(), $index['default_language']);
}
}

输出将类似于

name_text has default language: english
  • MongoDB Collection::createIndex()

  • MongoDB Collection::listIndexes()

  • 文本索引 在 MongoDB 手册中的参考

返回

isSparse()