For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

MongoDB\Model\IndexInfo::isGeoHaystack()

New in version 1.4. :

Deprecated since version 1.16MongoDB 5.0 and later no longer supports geoHaystack indexes.. :

MongoDB\Model\IndexInfo::isGeoHaystack()

Return whether the index is a geoHaystack index.

function isGeoHaystack(): boolean

A boolean indicating whether the index is a geoHaystack index.

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

The output would then resemble:

pos_geoHaystack_x_1 has bucketSize: 5