Database
[{"productID":1,"reviews":[{"_id":1,"likes":[{"userID":1},{"userID":2}],"dislikes":[{"userID":3},{"userID":4}],"comment":"first comment"},{"_id":2,"likes":[{"userID":1},{"userID":2}],"dislikes":[{"userID":3},{"userID":4}],"comment":"first comment"}]}]
Query
db.collection.aggregate([{$match:{"productID":1}},{$unwind:"$reviews"},{$unwind:"$reviews.likes"},{$group:{_id:"$reviews.likes",count:{$sum:1},}},{$project:{_id:0,userID:"$_id.userID",count:1}}])