db.tv1.aggregate(
{$project:{title:1,_id:0,count:"$rating.count",rate:"$rating.value",country:"$tv_category"}},
{$match:{rate:{$gt:8}}},
{$group:{_id:"$country",count:{$sum:1}}},
{$project:{_id:0,country:"$_id",count:1}}
)
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |