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

MongoDB\Model\IndexInfo::is2dSphere()

Nuevo en la versión 1.4.

MongoDB\Model\IndexInfo::is2dSphere()

Devuelve si el índice es un 2dsphere índice.

function is2dSphere(): boolean

Un booleano que indica si el índice es un índice 2dsphere.

<?php
$collection = (new MongoDB\Client)->getCollection('test', 'places');
$collection->createIndex(['pos' => '2dsphere']);
foreach ($collection->listIndexes() as $index) {
if ($index->is2dSphere()) {
printf("%s has 2dsphereIndexVersion: %d\n", $index->getName(), $index['2dsphereIndexVersion']);
}
}

La vista de salida se ilustraría como sigue:

pos_2dsphere has 2dsphereIndexVersion: 3
  • MongoDB\Collection::createIndex()

  • MongoDB\Collection::listIndexes()

  • 2Índices dsphere referencia en el manual de MongoDB

Volver

getVersion()

En esta página