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

$geoNear allows missing or invalid GeoJSON "type" field

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Query Integration
    • Fully Compatible
    • ALL
    • Hide

      Run any $near or $geoNear match expressions, or $geoNear aggregation stage, with the near value as {$geometry: {type: <insert any gibberish here>, coordinates: [0,0]}} will be accepted, as long as there are 2 coordinates wrapped in an array for the coordinates field.

      Show
      Run any $near or $geoNear match expressions, or $geoNear aggregation stage, with the near value as {$geometry: {type: <insert any gibberish here>, coordinates: [0,0] }} will be accepted, as long as there are 2 coordinates wrapped in an array for the coordinates field.

      Most geo queries that are built on top of geometry_container do not allow an unknown or missing "type" field. However, $geoNear (match expression and agg stage) rely instead on `GeoNearExpression`, which skips the geometry_container layer, so it accepts a missing or invalid GeoJSON "type" field, and will treat it as type "Point". In fact, it would even accept the type field as any GeoJSON type, since it doesn't check the "type" field. This is misleading, and inconsistent with the other geo operators.

      As part of this ticket, we should consider incorporating geometry_container as part of GeoNearExpression to match behavior parity across geo expressions.

            Assignee:
            ted.tuckman@mongodb.com Ted Tuckman
            Reporter:
            will.buerger@mongodb.com Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: