[SERVER-13903] inconsistent treatment of null in $project comparisons vs other stages Created: 12/May/14 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 2.6.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Asya Kamsky | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | eng-m, query-44-grooming, usability | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||
| Description |
|
If a field is missing (undefined), in project stage it is impossible to determine that by comparing it to null.
This is inconsistent with many other places, including ifNull treating null and undefined the same, as well as group (_id null and undefined all go into one bucket). If this is intentional then it should be documented. Tiny bit related to this is |
| Comments |
| Comment by Asya Kamsky [ 03/Aug/20 ] |
|
$isNull expression would allow such a check. |
| Comment by Asya Kamsky [ 15/Jul/15 ] |
|
This turns out to be problematic as there is no test for $nullish values. The only workaround to avoid errors is to use $ifNull to inject an explicit null so that comparison to null works. |