Docs Menu

MongoDB\Model\IndexInfo::isText()

バージョン 1.4 で追加

MongoDB\Model\IndexInfo::isText()

インデックスがテキストインデックスであるかどうかを返します。

function isText(): boolean

インデックスが テキスト インデックスかどうかを示すブール値。

<?php
$collection = (new MongoDB\Client)->getCollection('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