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

$near won't accept GeoJSON structure against legacy coordinates.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Geo, Querying
    • None
    • ALL
    • Hide

      use test
      db.testgeo.createIndex({"geo": "2d"})
      db.testgeo.insert({geo: [-96.772827, 32.872667]});

      Legacy form works:

      db.testgeo.find({geo: { $near: [-96.772827, 32.872667]}})

      GeoJson form doesn't work.

      db.testgeo.find({ "geo" : { "$near" : { "$geometry" : { "type" : "Point", "coordinates" : [-96.772827, 32.872667] } } } })

      Show
      use test db.testgeo.createIndex({"geo": "2d"}) db.testgeo.insert({geo: [-96.772827, 32.872667]}); Legacy form works: db.testgeo.find({geo: { $near: [-96.772827, 32.872667]}}) GeoJson form doesn't work. db.testgeo.find({ "geo" : { "$near" : { "$geometry" : { "type" : "Point", "coordinates" : [-96.772827, 32.872667] } } } })

    Description

      This works correctly from 2.4 -> 2.5.3. It begins failing in 2.5.4 and is still broken in 2.6. Server ticket SERVER-9341 seems to indicate this is not supported, but our documentation indicates that geoJson is an accepted format for 2D indices. In addition, since this works correctly in 2.4.10, it seems that this should continue to work; otherwise it is a backwards breaking change.

      Error Message:

      QueryFailure flag was Unable to execute query: error processing query: ns=milieu.venues limit=4 skip=0
      Tree: GEONEAR  field=location.geo maxdist=1.79769e+308 isNearSphere=0 First: notFirst: full path: location.geo
      Sort: {}
      Proj: {}
       planner returned error: unable to find index for $geoNear query (response was { "$err" : "Unable to execute query: error processing query: ns=milieu.venues limit=4 skip=0\nTree: GEONEAR  field=location.geo maxdist=1.79769e+308 isNearSphere=0 First: notFirst: full path: location.geo\nSort: {}\nProj: {}\n planner returned error: unable to find index for $geoNear query", "code" : 17007 }).

      Attachments

        Activity

          People

            Unassigned Unassigned
            craig.wilson@mongodb.com Craig Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: