nearSphere() public method

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 also: Builder::nearSphere()
See also: http://docs.mongodb.org/manual/reference/operator/nearSphere/
public nearSphere ( float | array | GeoJson\Geometry\Point $x, float $y = null )
$x float | array | GeoJson\Geometry\Point
$y float
Esempio n. 1
0
 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());
 }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
0
 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());
 }