Ejemplo n.º 1
0
 /**
  *  handle a spatial call
  *  
  *  the form is taken from: http://www.mongodb.org/display/DOCS/Geospatial+Indexing
  *           
  *  @since  10-18-10
  *  @param  string  $name the field name
  *  @param  array $point  a latitude and longitude point
  *  @param  integer $distance the radius around the point
  *  @return MingoCriteria   
  */
 public function nearField($name, $point, $distance)
 {
     // canary, make sure the point is valid...
     $field = new MingoField();
     $field->setType(MingoField::TYPE_POINT);
     $point = $field->normalizeInVal($point);
     $near_command = $this->normalizeCommand('near');
     $val = array($near_command => $point, $this->normalizeCommand('maxDistance') => (int) $distance);
     return $this->setWhereVal($name, '', $val, array($near_command));
 }