[SERVER-813] Add radius to $near Created: 23/Mar/10 Updated: 12/Jul/16 Resolved: 01/Apr/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 1.3.4 |
| Fix Version/s: | 1.5.0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | pitchfork media, inc | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Backwards Compatibility: | Minor Change |
| Participants: |
| Description |
|
add a radius parameter to $near to prevent sparsely populated regions from sucking in objects from areas nowhere nearby. example: http://dpaste.com/175056/. |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 11/Oct/10 ] |
|
No - its in radians - so 1 ~ 69 miles |
| Comment by Abe Park [ 11/Oct/10 ] |
|
@Eliot: assert.gt( 3 , a( t.find( { loc : { $near : [ 50 , 50 ] , $maxDistance : 3 }} ).limit(50) ) , "C3" ) is the distance value 3 in miles? |
| Comment by Eliot Horowitz (Inactive) [ 26/Apr/10 ] |
|
in a release |
| Comment by auto [ 01/Apr/10 ] |
|
Author: {'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: $maxDistance for $near |
| Comment by Eliot Horowitz (Inactive) [ 01/Apr/10 ] |
|
assert.lt( 3 , a( t.find( { loc : { $near : [ 50 , 50 ] } } ).limit(50) ) , "C1" ) } ).limit(50) ) , "C2" ) } ).limit(50) ) , "C3" ) |
| Comment by auto [ 01/Apr/10 ] |
|
Author: {'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: first cut at radius limiting $near |
| Comment by auto [ 01/Apr/10 ] |
|
Author: {'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: first cut at radius limiting $near |
| Comment by pitchfork media, inc [ 23/Mar/10 ] |
|
code example w/o dpaste's fancy formatting: from datetime import datetime, timedelta db = Connection().geotest db.events.insert( {'title': "Juneau Celebration @ Downtown", 'location': [58.3019444, -134.4197222]}) ) ) events = db.events.find({'location': {'$near': [58.30509234132916, results = [u'Juneau Celebration @ Downtown', # very close db.drop_collection("events") |