-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Query Execution
-
(copied to CRM)
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"]}]} } } ]);