Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of PHP Library Manual, refer to the upgrade documentation.

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

<?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']);
    }
}

The output would then resemble:

name_text has default language: english