[SERVER-8288] geo queries are order dependent when using $maxDistance Created: 23/Jan/13  Updated: 10/Dec/14  Resolved: 18/Apr/14

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Ross Lawley Assignee: Unassigned
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-1990 $near and $maxDistance shouldn't requ... Closed
Operating System: ALL
Participants:

 Description   

Test case:

use geo
db.zips.drop();
db.zips.insert({ "city": "KELLYTON", "zip": "35089", "loc": { "y": 32.979068, "x": 86.048397 }, "pop": 1584, "state": "AL" });
db.zips.insert({ "city": "NEW SITE", "zip": "35010", "loc": { "y": 32.941445, "x": 85.951086 }, "pop": 19942, "state": "AL" });
db.zips.insert({ "city": "GOODWATER", "zip": "35072", "loc": { "y": 33.074642, "x": 86.078149 }, "pop": 3813, "state": "AL" });
db.zips.insert({ "city": "MILLERVILLE", "zip": "36267", "loc": { "y": 33.158959, "x": 85.969001 }, "pop": 863, "state": "AL" });
db.zips.insert({ "city": "JACKSONS GAP", "zip": "36861", "loc": { "y": 32.879698, "x": 85.848662 }, "pop": 2236, "state": "AL" });
db.zips.ensureIndex({loc: '2d'});
 
db.zips.find({loc : {$nearSphere : [33.0, 86.0], $maxDistance : 0.1}}).count()  // returns 2 record
 
 
db.zips.find({loc : {$maxDistance : 0.1, $near: [33.0, 86.0]}}).count()
error: {
    "$err" : "geo values have to be numbers :: caused by :: { 0: 0.1, 1: [ 33.0, 86.0 ] }",
    "code" : 13026
}

Some languages (python) don't have control over the order of items in dictionaries. There is a SON type but forcing the user to use this seems the wrong place to fix it.



 Comments   
Comment by A. Jesse Jiryu Davis [ 23/Jan/13 ]

Seems minor, but every one of these order-dependent special cases in the server requires multiplied work in every driver implementation.

Generated at Thu Feb 08 03:17:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.