Aktualizujte první $match
do
{
"$match": {
"_id": ObjectId("595e3b2033961713940442cf"),
"History.datetime": {
"$lte": 1507529239000,
"$gte": 1507012285558
},
"History.Action": {
"$in": [
"Comment",
"like"
]
}
}
}
a druhý $match
do
{
"$match": {
"History.datetime": {
"$lte": 1507529239000,
"$gte": 1507012285558
},
"History.Action": {
"$in": [
"Comment",
"like"
]
}
}
}
a $group
do
{
"likecount": {
"$sum": {
"$cond": [
{
"$eq": [
"$History.Action",
"like"
]
},
1,
0
]
}
}
}