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

Provide a Symmetric Difference operator to new set operators in aggregation framework

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Query Execution

      In the new set operators, there is not a symmetric difference operator. This is one of the 4 main operators (in addition to intersection, union, and relative complement) on sets that it seems should be part of the new set operators.

      It probably would make sense to call this operator $setSymmetricDifference in order to follow the C++ naming convention of these operators.

      There is currently a work around, but it is much slower than implementing in code:

      db.colors.aggregate([
      {'$project': { 
      diff:{$setUnion:[{$setDifference:["$left","$right"]}, {$setDifference:["$right","$left"]}]}
      }
      }
      ]);
      

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            jacob.ribnik@mongodb.com Jacob Ribnik
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: