我是mongodb的新手,仍然坐在同一条管道上。我不明白为什么我对$project的使用根本没有产生任何输出?你知道吗
def make_pipeline():
# complete the aggregation pipeline
pipeline = [
{
'$match': {
"user.statuses_count": {"$gt":99 },
"user.time_zone": "Brasilia"
}
},
{
"$group": {
"_id": "$user.id",
"followers": { "$max": "$user.followers_count" }
}
},
{
"$sort": { "followers": -1 }
},{"$project": {
"userId": "$user.id",
"screen_name": "$user.screen_name",
"retweet_count": "$retweet_count"}},
{
"$limit" : 1
}
]
有什么想法吗?你知道吗
尝试下面的聚合管道,它将为您提供所需的输出。你知道吗
使用Mongo shell: 测试文档(具有最小测试用例):
魔法:
输出:
更新
Python实现:
相关问题 更多 >
编程相关推荐