[SERVER-63368] $lookup matches empty arrays to null/missing/undefined Created: 07/Feb/22 Updated: 16/Mar/22 Resolved: 15/Mar/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Irina Yatsenko (Inactive) | Assignee: | Yoon Soo Kim |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | mql-semantics | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||
| Sprint: | QE 2022-02-21, QE 2022-03-21 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
Local collection L: [{lkey:[]}] The query matches all three foreign records to the local record. Proposed semantics for matching empty arrays ("matches X" below means "matches value X from the foreign field").
|
| Comments |
| Comment by Ethan Zhang (Inactive) [ 09/Mar/22 ] |
|
Quote Irina: In SBE top-level empty local array matches to nothing, and nested local empty array matches to nested empty foreign array (it should match to top-level empty array in foreign as well – that is a bug in SBE) |
| Comment by Irina Yatsenko (Inactive) [ 08/Mar/22 ] |
|
It has been decided that empty arrays in local should not match null/missing in foreign. We should fix this in the classic engine and implement the same semantics in SBE. |
| Comment by Asya Kamsky [ 07/Mar/22 ] |
|
To me the comment in the code specifically indicates that the current behavior is intentional - i.e. when array is empty, treat it as if the value is "missing". However, I'm not convinced that's correct behavior since the array local/foreign semantics were supposed to be more like $in ... and $in:[] matches nothing.
|
| Comment by Eric Cox (Inactive) [ 02/Mar/22 ] |
|
christopher.harris Has there been any updates around this ticket? |