[SERVER-9891] $unwind should have a way to request uniquification. Created: 10/Jun/13 Updated: 14/Apr/16 Resolved: 08/Apr/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Mathias Stearn | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Participants: |
| Description |
|
not sure on syntax yet but it would be nice to be able to $unwind unique items in an array. eg: {_id: 1, a: [1,2,1,3,1,2]} would yield {_id:1, a:1}, {_id:1, a:2}, {_id:2, a:3}. Probably don't want to require order preservation. |
| Comments |
| Comment by Asya Kamsky [ 08/Apr/15 ] | ||||
|
This is now possible via $setUnion prior to $unwind. | ||||
| Comment by Jochen Kemnade [ 07/Nov/14 ] | ||||
|
I didn't know about $setUnion. That does the trick for me. | ||||
| Comment by Asya Kamsky [ 07/Nov/14 ] | ||||
|
Don't set operators make this request obsolete?
So you already can get from set with repetition to unique set, now you just unwind it. | ||||
| Comment by Jochen Kemnade [ 06/Nov/14 ] | ||||
|
If I understand this correctly, this would make the $unwind, $group/$addToSet $unwind pattern obsolete. |