Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
Click here >
Docs Menu
Docs Home
/ /

MongoDB\Model\IndexInfo::isText()

Nuevo en la versión 1.4.

MongoDB\Model\IndexInfo::isText()

Devuelve si el índice es un text index.

function isText(): boolean

Un valor booleano que indica si el índice es un índice de texto.

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

La vista de salida se ilustraría como sigue:

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

  • MongoDB\Collection::listIndexes()

  • Índices de texto referencia en el manual de MongoDB

Volver

isSparse()

En esta página