我知道python-eve支持aggregation和filtering。我知道如何分开使用它们:我可以指定python-eve中的哪个位置并同时进行聚合吗?
$ curl -i http://example.com/posts?aggregate={"$value": 2}
http://eve-demo.herokuapp.com/people?where={"lastname": "Doe"}
但问题是:我可以同时使用它们吗?
例如,我曾这样定义端点:
posts = {
'datasource': {
'aggregation': {
'pipeline': [
{"$unwind": "$tags"},
{"$group": {"_id": "$tags", "count": {"$sum": "$value"}}},
{"$sort": SON([("count", -1), ("_id", -1)])}
]
}
}
}
我可以使用查询网址,如:
http://eve-demo.herokuapp.com/people?where={"lastname": "Doe"}&aggregate={"$value": 2}