Database

[{"collection":"conversations","count":100,"content":{"_id":{"type":"autoincrement","autoType":"int","startInt":0},"userIdSender":{"type":"int","minInt":0,"maxInt":20},"userIdReceiver":{"type":"int","minInt":0,"maxInt":20}}},{"collection":"users","count":20,"content":{"_id":{"type":"autoincrement","autoType":"int","startInt":0},"isBlocked":{"type":"enum","in":[false,false,false,false,true]}}}]

Query

db.conversations.aggregate([{/** select sender or receiver*/$match:{"$or":[{"userIdReceiver":16},{"userIdSender":16}]}},{/** lookup the users*/"$lookup":{"from":"users","let":{"userIdSender":"$userIdSender","userIdReceiver":"$userIdReceiver"},"pipeline":[{/** only need this conversation's users*/"$match":{"$expr":{"$in":["$_id",["$$userIdSender","$$userIdReceiver"]]}}},{/** only care if they are blocked*/"$project":{"_id":0,"isBlocked":1}}],"as":"blockTest"}},{/** eliminate conversations where either user is blocked*/"$match":{"$expr":{"$or":"$blockTest.isBlocked"}}},{/** don't need lookup info anymore*/"$unset":"blockTest"}])

Result