[SERVER-6258] $addToSet group operator should maintain insert order Created: 29/Jun/12  Updated: 15/Aug/12  Resolved: 30/Jun/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:

 Description   

Currently uses an unordered_set<>. Needs to maintain insert order so a pipeline like this has the original comment order:

db.posts.aggregate(
    {$unwind: 'comments'},
    {$match: {'comments.deleted': {$ne: true}}},
    {$group: {_id: '$_id', comments: {$addToSet: '$comments'}}}
);



 Comments   
Comment by Eliot Horowitz (Inactive) [ 30/Jun/12 ]

I don't think thats a guarantee we want to make.

Generated at Thu Feb 08 03:11:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.