我正在使用 Eve 为 MongoDB 创建一个 RESTful API。也许我做错了什么,但我不明白为什么 Eve 没有返回我的汇总结果。以下是我的域:
DOMAIN = {
'heartbeats': {
'schema': {
'user': {
'type': 'objectid',
'required': True,
},
'device': {
'type': 'objectid',
'required': True,
},
'pir': {
'type': 'integer'
},
'camera': {
'type': 'integer'
},
'image': {
'type': 'media',
'required':False
}
}
},
'chart1' : {
'datasource':{
'source' : 'heartbeats',
'aggregation' : {
'pipeline': [
{"$group" : {"_id":"$user", "count" : {"$sum" : 1}}}
]
}
}
}
}
从浏览器查询时,我只得到所有记录,而不是汇总结果。
为什么我没有得到汇总结果?