db.appMsgCollection.aggregate (
[ { $ lookup :{ FROM :"msgTypeCollection",
localField :"message.templateTypeId",
foreignField :"msgTypeId",
AS :"cname" } },
{ $ MATCH :{ "createTime" :{ "$gte" :ISODate (
"2020-04-01T00:00:00.000+08:00"
),
"$lt" :ISODate ("2020-05-01T00:00:00.00+08:00") },
"accessId" :{ $ ne :"msgcenter" } } },
{ $ GROUP :{ _id :"$message.msgTitle",
msgTitle :{ $ FIRST :"$message.msgTitle" },
cname :{ $ FIRST :"$cname.cname" },
templateTypeId :{ $ FIRST :"$message.templateTypeId" },
msgContent :{ $ FIRST :"$message.msgContent" },
sendCount :{ $ SUM:1 },
pushTime :{ $ FIRST :"$createTime" },
} } ]
)