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

Issues with {$geometry: [x,y]} syntax

    • Query Integration

      The $geometry docs say that $geometry must always be a valid GeoJSON spec, but we inconsistently handle syntax where $geometry is given a coordinate pair array.

      $geoIntersects

      This syntax is considered valid under $geoIntersects like

      db.geo.find({loc: {$geoIntersects: {$geometry: [0, 0]}}})
      

      We should either add test coverage for that query, or decide to disallow it since it's inconsistent that we allow it.

      $geoWithin

      $geoWithin rejects it correctly since you cannot query for "within" a point; with the error message "$within not supported with provided geometry: <>".

      $near/$geoNear/$nearSphere

      $near rejects it by saying "$near requires geojson point, given { 0: 0.0, 1: 0.0 }". However, that error message is misleading. $near could accept a legacy point like [0,0], so a more accurate error message would be "$geometry under $near requires a geojson point..." or simply "$geometry requires GeoJSON..." The error messages should be fixed to be more correct.

            Assignee:
            kateryna.kamenieva@mongodb.com Katya Kamenieva
            Reporter:
            will.buerger@mongodb.com Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: