Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-27968

$geoWithin with $centerSphere does not find GeoJSON documents other than Points

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.4.0
    • Fix Version/s: 3.6.0-rc0
    • Component/s: Geo, Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.4
    • Sprint:
      Query 2017-11-13

      Description

      Compare:

      > db.poiConcat.find( { ty: 1, l: { $geoWithin: { $centerSphere: [ [ -80.1745962, 26.148911 ], 50000000 ] } } } ).limit(1);
      { "_id" : "n99364450", "ty" : NumberLong(1), "l" : { "type" : "Point", "coordinates" : [ -80.3810378, 25.5883277 ] }, "ts" : [ "amenity=parking" ], "m" : { "v" : NumberLong(4), "cs" : NumberLong(18737061), "uid" : NumberLong(1795637), "ts" : NumberLong(1383685090) } }
      

      > db.poiConcat.find( { ty: 2, l: { $geoWithin: { $centerSphere: [ [ -80.1745962, 26.148911 ], 500000 ] } } } ).limit(1);
      

      With a distance of 500km, it should certainly find documents. The range below (1 degree) is much less (about 100km):

      > > db.poiConcat.find( { ty: 2, l: { $geoWithin: { $geometry : { type: 'Polygon', coordinates : [ [ [ -80.1745962, 26.148911 ], [ -79, 26 ], [ -79, 25 ], [ -80, 25 ], [ -80.1745962, 26.148911 ] ] ] } } } } ).limit(1);
       
      { "_id" : "w414476448", "ty" : NumberLong(2), "l" : { "type" : "Polygon", "coordinates" : [ [ [ -80.1091137, 26.0908518 ], [ -80.1090739, 26.0907767 ], [ -80.1092148, 26.0907164 ], [ -80.1092547, 26.0907915 ], [ -80.1091137, 26.0908518 ] ] ] }, "ts" : [ "name=Jetty Pavilion", "amenity=shelter", "building=yes" ], "m" : { "v" : NumberLong(1), "cs" : NumberLong(38985825), "uid" : NumberLong(684651), "ts" : NumberLong(1461953735) } }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              wan.bachtiar Wan Bachtiar
              Reporter:
              derick Derick Rethans
              Participants:
              Votes:
              2 Vote for this issue
              Watchers:
              16 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: