$startplushowmany=$startfrom+$howmany; //$startplush is 40
$cursor=$cursor->limit($startplushowmany);
$numberReturned=$cursor->count(); //$numberReturned is 45
I can’t show you the content of the $cursor because $cursor do not implement _toString. Please let me know how to do so.
Now the query in the $cursor is defined by this command:
$cursor = $collection->find($rangeQuery, $field);
where $rangeQuery is
(string:592) Array
(
[LongitudeLatitude] => Array
(
[$within] => Array
(
[$center] => Array
(
[0] => Array
(
[0] => 106.772835
[1] => -6.186753
)
[1] => 0.044983732050783
)
)
)
[indexContents] => bas
[Prominent] => Array
(
[$gte] => 15
)
)
and
$field is
(string:39) Array
(
[LongitudeLatitude] => 1
)
You need to use a boolean flag to have count taking limit in consideration, else it gives the actual
count
$numberReturned=$cursor->count(true);Quoting example from PHP doc :
Will output :