-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Minor - P4
-
None
-
Affects Version/s: 4.0.0-rc4
-
Component/s: Aggregation Framework
-
Labels:None
db.blacklist.aggregate([ { $project: { contact: 1, profile: 1 } }, { $match: { contact: 'SELF_ID_STR' }, // * if we not have result, pipe stay on whis step. // convert results to { _id: null, blocked_list: [idslist...] } { $group: { _id: null, blocked_list: { $push: { $toObjectId: '$profile' } } } }, { $lookup: { from: 'profiles', as: 'profiles', let: { ignore: '$blocked_list' }, pipeline: [ // * cant use $nin in aggregate // * cant modify results for add self profile to exclude { $match: { $expr: { $not: { $in: ['$_id', '$$ignore'] } } } } ] } }, { $unwind: '$profiles' }, { $replaceRoot: { newRoot: '$profiles' } } ]);