[SERVER-84598] $geoNear allows missing or invalid GeoJSON "type" field Created: 05/Jan/24 Updated: 06/Feb/24 Resolved: 06/Feb/24 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.3.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Will Buerger | Assignee: | Ted Tuckman |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng, qi-geo | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Assigned Teams: |
Query Integration
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||
| Steps To Reproduce: | 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. |
||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
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. |
| Comments |
| Comment by Githook User [ 06/Feb/24 ] |
|
Author: {'name': 'Ted Tuckman', 'email': 'ted.tuckman@mongodb.com', 'username': 'TedTuckman'}Message: GitOrigin-RevId: a12bc613e2d94c85bb2c386538ecf25c8315d05d |