本文共 672 字,大约阅读时间需要 2 分钟。
db.getCollection("ny_room_browse_record").aggregate( [ { "$match" : { "wechat_user_space_id" : 1 } }, { "$group" : { "_id" : { "room_id" : "$room_id", "room_name" : "$room_name" }, "count" : { "$sum" : NumberInt(1) }, } }, { "$project" : { "room_id" : "$_id.room_id", "room_name" : "$_id.room_name", "count" : "$count", "_id" : "$_id" } }, ]);
转载地址:http://gqhdz.baihongyu.com/