LMongo\Query\Builder::whereNear PHP Method

whereNear() public method

Add an "$near geospatial operation" clause to logical operation.
public whereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null, string $boolean = 'first' ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
$boolean string
return LMongo\Query\Builder
    public function whereNear($column, array $coords, $geometry = null, $maxDistance = null, $boolean = 'first')
    {
        if (is_null($geometry)) {
            $value = array('$near' => $coords);
            if (!is_null($maxDistance)) {
                $value['$maxDistance'] = $maxDistance;
            }
        } else {
            $value = array('$near' => array('$geometry' => array('type' => $geometry, 'coordinates' => $coords)));
            if (!is_null($maxDistance)) {
                $value['$near']['$geometry']['$maxDistance'] = $maxDistance;
            }
        }
        return $this->where($column, $value, $boolean);
    }
Builder