-
Type: Bug
-
Resolution: Cannot Reproduce
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.2.2
-
Environment:Amazon Linux AMI x86_64 EBS, Micro Instance (613 MiB memory)
-
Fully Compatible
-
ALL
-
The results given by runCommand with in a distinct query using the $near operator are different from the equivalent *db.advice.distinct* query.
When we run the following command, we get 100 results:
db.runCommand ( { "distinct" : "advice" , "key" : "somekey" , "query" : { "latlon" : { "$near" : [ 59.333972499999994 , 18.057507599999997]} , "title" : { "$ne" : ""} , "text" : { "$ne" : ""} } } )
, and running the equivalent query using distinct returns only 75:
db.advice.distinct('somekey', { "latlon" : { "$near" : [ 59.333972499999994 , 18.057507599999997]} , "title" : { "$ne" : ""} , "text" : { "$ne" : ""} })
We don't understand why we get different results because the second query is a wrapper around the first one. In any case, we wanted to use the first query (runCommand) in the Java driver because it gives us the results that we need. Thus, we wrote the runCommand query in Java but the result that we got is the same as if we were using the db.advice.distinct query.