I have two collections:
reviews
and reviewLikeDislikes that contains reviewId and type (enum: liked or disliked)
and I am doing a query on reviews to get the number of likes and dislikes.
Here is my implementation:
{
$lookup: {
from: 'reviewLikesDislikes',
localField: '_id',
foreignField: 'reviewId',
as: 'likesAndDislikes',
},
},
how do I filter the lookup where I get likes count and dislikes count