I want to sort the results with loc array length > 0
$cursor = $this->mongodb->command(array(
'geoNear' => "place",
'near' => $lonlat,
'spherical' => true,
'num' => 20,
'query' => array("loc->0" => array("$exists" => true))
));
[0] => Array
(
[loc] => Array
(
[type] => Point
[coordinates] => Array
(
[0] => 32.929092407227
[1] => 39.960571289062
)
)
)
[1] => Array
(
[loc] => Array
(
)
)
I want to sort the results with loc array length > 0
How do I do it?
I Need only not empty loc