here i have create one query for the show count date wise in the chart. and i have used mongodb. and i have one object and in the object store multiple data and separate with on
Update first $match
to
{
"$match": {
"_id": ObjectId("595e3b2033961713940442cf"),
"History.datetime": {
"$lte": 1507529239000,
"$gte": 1507012285558
},
"History.Action": {
"$in": [
"Comment",
"like"
]
}
}
}
and second $match
to
{
"$match": {
"History.datetime": {
"$lte": 1507529239000,
"$gte": 1507012285558
},
"History.Action": {
"$in": [
"Comment",
"like"
]
}
}
}
and $group
to
{
"likecount": {
"$sum": {
"$cond": [
{
"$eq": [
"$History.Action",
"like"
]
},
1,
0
]
}
}
}