public function whereNearSphere($column, array $coords, $geometry = null, $maxDistance = null, $boolean = 'first')
{
if (is_null($geometry)) {
$value = array('$nearSphere' => $coords);
if (!is_null($maxDistance)) {
$value['$maxDistance'] = $maxDistance;
}
} else {
$value = array('$nearSphere' => array('$geometry' => array('type' => $geometry, 'coordinates' => $coords)));
if (!is_null($maxDistance)) {
$value['$nearSphere']['$geometry']['$maxDistance'] = $maxDistance;
}
}
return $this->where($column, $value, $boolean);
}