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

$addToSet group operator should maintain insert order

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Aggregation Framework
    • None

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: