It works, but I would like to switch over to using the aggregration pipeline framework to do this if possible. It does not seem like it is easy to compare two collections… I have been trying this for a while with no luck. $setUnion and $setDifference look promising, but I can’t find a way to set the union of the likes & dislikes of the user, and then the difference of that with all products.
You are on the right track. $setUnion will combine likes and dislikes array, but unfortunately $setDifference won’t work across collections. We have to deploy $lookup stage to compare and get all the products that are not in likes or dislikes array. Something like this - https://mongoplayground.net/p/MNl2icwWEsM. Let me know if you have any questions.