selectCollection('kpmaster', 'kpu'); $cursor = $collection->aggregate([['$geoNear' => ['near' => ['type' => 'Point', 'coordinates' => [76.768, 8.736]], 'spherical' => true, 'query' => ['srvs' => ['$all' => ['One']]], 'distanceField' => 'Dis', 'maxDistance' => 2000, 'includeLocs' => 'loc']], ['$project' => ['ID'=>'$oid', 'Name' => '$fn', 'Distance' => '$Dis', 'Location' => '$loc']]]); echo json_encode(iterator_to_array($cursor)); ?>