MongDB aggregation _ sample
[{
$match: {
createdTime: {
$gt: ISODate('2022-08-23T00:00:00.000Z')
}
}
}, {
$match: {
invalidType: {
$ne: 'InvalidUser'
}
}
}, {
$match: {
$and: [
{
message: {
$ne: 'succed'
}
},
{
retryNeeded: {
$ne: false
}
}
]
}
}, {
$group: {
_id: '$activityId',
records: {
$push: '$$ROOT'
},
num: {
$sum: 1
}
}
}]
取一段时间之后的数据
排除 部分数据
按 activityId 对数据进行分组,统计 & 组合为数组

浙公网安备 33010602011771号