public function testExpressionNearPointArrayDistabce()
{
// this feature allowed only in MongoDB 2.6
if (version_compare($this->collection->getDatabase()->getClient()->getDbVersion(), '2.6', '<')) {
return;
}
$this->collection->ensure2dSphereIndex('location');
$document1Id = $this->collection->createDocument()->setPoint('location', 24.012228, 49.831485)->save()->getId();
$document2Id = $this->collection->createDocument()->setPoint('location', 34.551416, 49.588264)->save()->getId();
// point before min-max range
$document = $this->collection->find()->nearPoint('location', 34.551, 49.588, array(null, 5))->findOne();
$this->assertEmpty($document);
// point before min-max range
$document = $this->collection->find()->nearPoint('location', 34.551, 49.588, array(1, 5))->findOne();
$this->assertEmpty($document);
// point in min-max range
$document = $this->collection->find()->nearPoint('location', 34.551, 49.588, array(5, 50))->findOne();
$this->assertNotEmpty($document);
$this->assertEquals($document2Id, $document->getId());
// point after min-max range
$document = $this->collection->find()->nearPoint('location', 34.551, 49.588, array(50, 500))->findOne();
$this->assertEmpty($document);
// point autside min range
$document = $this->collection->find()->nearPoint('location', 34.551, 49.588, array(50, null))->findOne();
$this->assertNotEmpty($document);
$this->assertEquals($document1Id, $document->getId());
}