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::isText()
New in version 1.4.
Definition
MongoDB\Model\IndexInfo::isText()Return whether the index is a text index.
function isText(): boolean
Return Values
A boolean indicating whether the index is a text index.
Examples
$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']); } }
The output would then resemble:
name_text has default language: english
See Also
Text Indexes reference in the MongoDB manual