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::isGeoHaystack()

New in version 1.4.

Definition

MongoDB\Model\IndexInfo::isGeoHaystack

Return whether the index is a geoHaystack index.

function isGeoHaystack(): boolean

Return Values

A boolean indicating whether the index is a geoHaystack index.

Examples

<?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