Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6258

$addToSet group operator should maintain insert order

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None

      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'}}}
      );
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: