[SERVER-20499] Aggregation $project generates new array fields differently than new non-array fields Created: 18/Sep/15 Updated: 09/Jul/16 Resolved: 23/Sep/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 3.1.8 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Asya Kamsky | Assignee: | Charlie Swanson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Participants: |
| Description |
|
This aggregation, when aaaa and bbbb are both non-existent fields generates inconsistent result:
I would have expected aaaa to be missing and bbbb to be an empty array, not an array with explicit null. That seems more consistent with aaaa showing up with null value. |
| Comments |
| Comment by Charlie Swanson [ 23/Sep/15 ] |
|
Closing as 'Works as Designed', as this was the intended behavior. The rationale was that by substituting null instead of removing it, the array indices stay the same. If you construct an array with 3 elements, it will always have 3 elements. This need to be documented more clearly, but I don't think the behavior should change. |