Below is the Mongo query I am using, but this is returning 100 as max records even if I increase the maxDistance to the maximum possible value. I know there are lot of records mongo is not returning, value more than 15 miles as a maxDistance its always returning 100 documents , please help.
db.business.aggregate([
{ "$geoNear" : {
"maxDistance" : 0.005046438589510322, --this is 15 miles
"distanceMultiplier" : 3963.191 ,
"near" : [ -84.464374 , 33.864826] ,
"spherical" : true ,
"distanceField" : "distance",
query: {
"category": { "$eq": "restaurant" }
}
}
} ,
{ "$match" : { "status" : { "$in" : [ "active"]}}}, {
$group: {
_id : null,
count : {$sum : 1}
}
}
])
You should add limit
, otherwise it uses the default which is to return the first 100 documents:
{ "$geoNear" : {
"maxDistance" : 0.005046438589510322, --this is 15 miles
"limit" 1000,
...
The above will return 1,000 documents
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With