Menu Docs

Página inicial do DocsManual da Biblioteca PHP

MongoDB\Model\IndexInfo::isGeoHaystack()

Nesta página

  • Definição
  • Valores de retorno
  • Exemplos
  • Veja também

Novidade na versão 1.4.

Descontinuado desde a versão 1.16: MongoDB 5.0 e posterior não suportam mais índices geoHaystack.

MongoDB\Model\IndexInfo::isGeoHaystack()

Retorna se o índice é um índicegeoHaystack .

function isGeoHaystack(): boolean

Um booleano que indica se o índice é um índice geoHaystack.

<?php
$collection = (new MongoDB\Client)->selectCollection('test', 'places');
$collection->createIndex(['pos' => 'geoHaystack', 'x' => 1], ['bucketSize' => 5]);
foreach ($collection->listIndexes() as $index) {
if ($index->isGeoHaystack()) {
printf("%s has bucketSize: %d\n", $index->getName(), $index['bucketSize']);
}
}

A saída seria então semelhante a:

pos_geoHaystack_x_1 has bucketSize: 5
← MongoDB\Model\IndexInfo::is2dSphere()