0

I have the next query:

db.getCollection('dealers').aggregate([{ "$geoNear" : { "near" : { "type" : "Point" , "coordinates" : [ 22.937506 , -30.559482]} , "spherical" : true , "distanceField" : "distance" , "maxDistance" : 21000000 , "num" : 6}}, { "$match" : { "$and" : [ { "brands" : { "$in" : [ "starbucks"]}} , { "country" : "za"} , { "language" : "en"}]}},{ $group: { _id: null, count: { $sum: 1 } } }, { "$limit" : 6}]);

I have two environments, the two environments have the same data and the same indexes, but when I run the above query, I get the first environment 6 registers and for the another 3 registers.

I checked and they have the same mongoDB version, Do you have any ideas about that?

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
jose rivera
  • 463
  • 2
  • 6
  • 14
  • how do you know that data is totally same? – Sergey Berezovskiy May 23 '17 at 14:31
  • @SergeyBerezovskiy I checked the two DBs and this is the same, I compared with this tool https://www.diffchecker.com/diff – jose rivera May 23 '17 at 14:33
  • No @SergeyBerezovskiy means how can you be sure mongodb DATA same in both DBs ? – Sercan Ozdemir May 23 '17 at 14:41
  • @SergeyBerezovskiy you were in the right, they have different data, thanks for your helping. I find that my problem is because first is done the $gear and after that $match. Do you know How could I put first the $match and after $gear – jose rivera May 23 '17 at 16:42
  • guys, mi problem was solved with this question https://stackoverflow.com/questions/42173956/mongodb-geonear-aggregation-pipeline-using-query-option-and-using-match-pipel?rq=1 thanks. – jose rivera May 23 '17 at 16:53

0 Answers0