I changed query to use within instead of near and now it works fine
$radiusOfEarth = 6378.1;//radius in km
$calculated_distance = (float) $distance / $radiusOfEarth;
$search = array(
'loc' => array('$within' =>
array('$centerSphere' =>
array(
array(floatval($lng), floatval($lat)), $calculated_distance
)
)
)
);
or
[loc] => Array
(
[$within] => Array
(
[$centerSphere] => Array
(
[0] => Array
(
[0] => -73.5539925
[1] => 45.5086699
)
[1] => 0.00501716812217
)
)
)