ensure2dSphereIndex() public method

Create geo index 2dsphere
public ensure2dSphereIndex ( string $field ) : Collection
$field string
return Collection
Example #1
0
 public function testExpressionWithinCircleSpherical()
 {
     $this->collection->ensure2dSphereIndex('point');
     $point1Id = $this->collection->createDocument()->setPoint('point', 30.5326905, 50.4020355)->save()->getId();
     $point2Id = $this->collection->createDocument()->setPoint('point', 28.4696339, 49.234734)->save()->getId();
     $point = $this->collection->find()->withinCircleSpherical('point', 28.46963, 49.2347, 0.001)->findOne();
     $this->assertNotEmpty($point);
     $this->assertEquals($point2Id, $point->getId());
 }