I have a collection of studies that has an array field of locations
which contain geo data in the longlat field ( e.g. "longlat" :
[174.792435, -41.246632]). I have a geo index on the studies
collection: { "locations.longlat" : "2d" }.
I have 1460 documents in the studies collection so I would expect this
query to return all of the documents:
> db.studies.find( { 'locations.longlat' : { $near : [-122.276474, 47.54158], $maxDistance : 180 } } ).limit(1500);
but:
> db.studies.find( { 'locations.longlat' : { $near : [-122.276474, 47.54158], $maxDistance : 1000 } } ).limit(1500).toArray().length;
99
Note I am using toArray().length because according to this:
https://jira.mongodb.org/browse/SERVER-2997 count() doesn't work with
$near queries in the shell.
All of my longlat coordinates are between [-180, 180] and I've
verified that all my studies have at least 1 location and all the
locations have values for longlat.
Am I doing something wrong or should I open a Jira ticket for this?
Thanks,
-Jesse