[SERVER-4674] aggregation: treat undefined values the same as null values Created: 12/Jan/12 Updated: 11/Jul/16 Resolved: 03/Jul/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | 2.2.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Chris Westin | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
$group currently doesn't allow for the grouping key to be undefined. The attached script demonstrates the problem, yielding this error for the last two cases: { |
| Comments |
| Comment by auto [ 03/Jul/12 ] |
|
Author: {u'date': u'2012-06-29T12:41:38-07:00', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}Message: Treat undefined as null in aggregation rather than erroring |
| Comment by auto [ 03/Jul/12 ] |
|
Author: {u'date': u'2012-06-29T12:22:44-07:00', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}Message: Make test more clear |
| Comment by auto [ 01/Mar/12 ] |
|
Author: {u'login': u'cwestin', u'name': u'U-tellus\\cwestin', u'email': u'cwestin@10gen.com'}Message: |
| Comment by Chris Westin [ 12/Jan/12 ] |
|
At the moment, you can work around this by preceding the $group with a $project in which you use a $ifNull to supply a value; $ifNull does treat undefined and null as the same. However, it makes me a bit nervous to do the same for group – I had a demonstrative test case come to me, but I've forgotten it; hopefully it will come back to me before I get to this, and we can decide if we care about it or not. |