Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /
Clase IndexInfo

MongoDB\Model\IndexInfo::isGeoHaystack()

Nuevo en la versión 1.4.

Obsoleto desde la versión 1.16: MongoDB 5.0 y versiones posteriores ya no admiten índices geoHaystack.

MongoDB\Model\IndexInfo::isGeoHaystack()

Devuelve si el índice es un geoHaystack index.

function isGeoHaystack(): boolean

Un valor booleano que indica si el índice es un í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']);
}
}

La vista de salida se ilustraría como sigue:

pos_geoHaystack_x_1 has bucketSize: 5
  • MongoDB\Collection::createIndex()

  • MongoDB\Collection::listIndexes()

  • Índices geoHaystack referencia en el manual de MongoDB

En esta página