How to compare 2 collections in MongodB (MapReduce?) and render subscribed collections?

How to compare (intersect) say:

Collection A: 'apple', 'orange', 'banana'
Collection B: 'apple', 'lemon'

Resulting output: 'apple'

Also how to render this resulting collection? Is it using

$in or $lookup? etc. 

Can $in be used to compare items by items for 2 collections? Someone mentioned MapReduce?

Saw these articles:

http://www.tutorialspoint.com/mongodb/mongodb_map_reduce.htm

But I just want to find items are that common to both collections and render it, thanks…

@niceseb - were you able to figure this out? I am trying to do the same except filtering out documents where the user IDs are within a group (from alanning:roles package)

First draft I’m working with:

const DesignsCollection = new Mongo.Collection('designs');

Meteor.publish('usersInMyGroup', function() {
    const _group = Roles.getGroupsForUser(this.userId)[0];
    const group_ids = Roles.getUsersInRole('customer', _group);
    
    DesignsCollection.find({ 'user_id': { $in: group_ids }}, { });
});

“user_id” is the ID of the user who created the design. I want to publish just the designs based on a group but all I have in the DesignsCollection is the user id who created the design.

UPDATE:
I was able to get mine to work using $in. I don’t expect a large number of user “groups” so I think this will work for now.

I turned the cursor that was returned from the Roles.getUsersInRole('customer', _group); into an array and then used that in my query.

var arr_ids = [];
group_ids.forEach(function(obj){arr_ids.push(obj._id)});

DesignsCollection.find({ ‘user_id’: { $in: arr_ids }}, { });