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 testMaxDistanceWithNearSphereAndLegacyCoordinates() { $expr = new Expr(); $expr->nearSphere(1, 2); $this->assertSame($expr, $expr->maxDistance(1)); $this->assertEquals(array('$nearSphere' => array(1, 2), '$maxDistance' => 1), $expr->getQuery()); }
/** * Add $nearSphere 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::nearSphere() * @see http://docs.mongodb.org/manual/reference/operator/nearSphere/ * @param float|array|Point $x * @param float $y * @return self */ public function nearSphere($x, $y = null) { $this->expr->nearSphere($x, $y); return $this; }
public function testMinDistanceWithNearSphereAndLegacyCoordinates() { $expr = new Expr(); $expr->nearSphere(1, 2); $this->assertSame($expr, $expr->minDistance(1)); $this->assertEquals(['$nearSphere' => [1, 2], '$minDistance' => 1], $expr->getQuery()); }