db.getCollection('chat').aggregate([
{
"$match": {
"last": 1,
"type": 0
}
},
{
$project:{giftId:1,text:1,userId:1,createAt:1}
},
{
$group:{
_id:'$giftId',
createAt:{$max:'$createAt'},
text:{$last:'$text'},
userId:{$last:'$userId'},
}
}
])
mongo聚合命令
猜你喜欢
转载自www.cnblogs.com/yzf666/p/9618198.html
今日推荐
周排行