db.getCollection('orders').aggregate((表名)
[
{
$match : { "status":2 , "endTime":{$gte:ISODate("2020-02-22T16:00:00.000Z"),$lte:ISODate("2020-02-23T16:00:00.000Z")},"channelId":{$ne:10000} }(查询条件)
} ,
{
$group :
{
_id : "$memberId", totalAmount: {$sum:"$money"},count: { $sum: 1 }(字段名称)
}
}
,{$sort:{count:-1}}
]
)
mongo金额字段汇总语句
最新推荐文章于 2023-11-02 11:51:25 发布