//加载票数最高的用户信息
let voteRes = await db.collection('meeting').aggregate()
.match({
clubId: clubId,
})
.group({
_id: '$group',
maxVote: $.max('$vote'),
members: $.push({
name:'$userName',
avatar:'$userAvatar',
userId:'$userId'
}),
})
.end()
想得到的结果:每个分组中投票最高的数据。
我拼了好几种方式也没有得出正确的结果!!