A GeoJSON point may be provided as the first and only argument for
2dsphere queries. This single parameter may be a GeoJSON point object or
an array corresponding to the point's JSON representation.
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()); }
/** * Add $near criteria to the query. * * A GeoJSON point may be provided as the first and only argument for * 2dsphere queries. This single parameter may be a GeoJSON point object or * an array corresponding to the point's JSON representation. * * @see Expr::near() * @see http://docs.mongodb.org/manual/reference/operator/near/ * @param float|array|Point $x * @param float $y * @return self */ public function near($x, $y = null) { $this->expr->near($x, $y); return $this; }
public function testMinDistanceWithNearAndLegacyCoordinates() { $expr = new Expr(); $expr->near(1, 2); $this->assertSame($expr, $expr->minDistance(1)); $this->assertEquals(['$near' => [1, 2], '$minDistance' => 1], $expr->getQuery()); }