[SERVER-10086] Set operations for Aggregation Framework $project Created: 03/Jul/13  Updated: 02/Aug/18  Resolved: 09/Aug/13

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

Type: Task Priority: Major - P3
Reporter: Stennie Steneker (Inactive) Assignee: Gregory McKeon (Inactive)
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CSHARP-792 support new aggregation pipeline oper... Closed
Related
Participants:

 Description   

Currently set operations require several steps of pipeline manipulation to produce the desired result. For example, see StackOverflow: How to use MongoDB aggregation for general purpose set operations (union, intersection, difference).

This is a feature request to add some new operations for more efficient processing in a $project pipeline stage:

1) $seq - similar to $eq, takes two sets and returns true if equal, false if not. If two lists are passed in, treat as multi-set
2) $ssub - is the first set a subet of the second, returns true if so
3) $sint - takes in two sets and provides the intersection of the two
4) $sdiff - provides the symetric difference between two sets
5) $sunion - provides the union of two sets



 Comments   
Comment by auto [ 09/Sep/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: SERVER-10086 print typeName rather than type number on type error in $set operators
Branch: master
https://github.com/mongodb/mongo/commit/a6f74a5a6e0691488ac372ee594ed18960488040

Comment by auto [ 26/Aug/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: SERVER-10086 fix $setDifference to return a set (spec changed)
Branch: master
https://github.com/mongodb/mongo/commit/c7493c4c4729b99be4bc293ad299ae55906fb79d

Comment by auto [ 13/Aug/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: SERVER-10086 fix improper removing from a container

also may fix SERVER 10496
Branch: master
https://github.com/mongodb/mongo/commit/072e12a5e5b853435e47046d979b307fa2676951

Comment by auto [ 09/Aug/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: SERVER-10086 $set operations for agg
Branch: master
https://github.com/mongodb/mongo/commit/a3ac5c0d4548a259b55aae11440ade070bc66195

Comment by Scott Roberts [ 17/Jul/13 ]

One utility feature that could be useful is to transform a list (which I am assuming is being treated as a multiset/bag) to a set. This would prevent me from having to explode and combine a list into a set. If something was already a set and you performed the $distinct/$asSet/etc then it would just be a no-op. Another way to look at this is adding a $distinct to projection rather than unwind->group. This could be useful outside of just set operation as well.

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