MongoDB\Model\IndexInfo::isText()
新在版本1.4.
定义
MongoDB\Model\IndexInfo::isText()
返回索引是否为文本 索引。
function isText(): boolean
返回值
一个布尔值,指示索引是否为文本索引。
示例
$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