public function near($x, $y = null)
{
if ($x instanceof Point) {
$x = $x->jsonSerialize();
}
if (is_array($x)) {
return $this->operator('$near', ['$geometry' => $x]);
}
return $this->operator('$near', [$x, $y]);
}
public function testMaxDistanceWithNearAndLegacyCoordinates() { $expr = new Expr(); $expr->near(1, 2); $this->assertSame($expr, $expr->maxDistance(1)); $this->assertEquals(array('$near' => array(1, 2), '$maxDistance' => 1), $expr->getQuery()); }