Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Pyev时,在使用get_internal时是否可以将参数传递到聚合管道?_Python_Mongodb_Eve - Fatal编程技术网

Python 使用Pyev时,在使用get_internal时是否可以将参数传递到聚合管道?

Python 使用Pyev时,在使用get_internal时是否可以将参数传递到聚合管道?,python,mongodb,eve,Python,Mongodb,Eve,我正在尝试调用一个带有参数的聚合管道,作为eve中服务器代码的一部分 [github]上的文档和代码表明,我应该能够使用get_internal调用管道,它应该使用传递给它的参数运行 我一直在努力 get_internal(“管道”,**{“id”:id,'time':time}) 但似乎没有将_id和时间参数传递给聚合查询 我已经通过访问管道URL验证了管道是否正常工作 ?聚合={u id:“5fa904807d3037e78023a5192,“时间”:1604827480260} 但我更愿意

我正在尝试调用一个带有参数的聚合管道,作为eve中服务器代码的一部分

[github]上的文档和代码表明,我应该能够使用get_internal调用管道,它应该使用传递给它的参数运行

我一直在努力

get_internal(“管道”,**{“id”:id,'time':time})

但似乎没有将_id和时间参数传递给聚合查询

我已经通过访问管道URL验证了管道是否正常工作

?聚合={u id:“5fa904807d3037e78023a5192,“时间”:1604827480260}

但我更愿意从服务器端代码中调用它,而不是在可能的情况下发出请求

有没有什么明显的事情是我做错了


谢谢

不幸的是,您不能将参数与
获取内部
和聚合一起使用。
\u执行
仅使用不可变的请求对象,而
\u执行(u find
将请求对象中的
查找
参数与
$和
合并

您可以像show works一样对url执行http请求,也可以使用
app.data.driver
,通过导入管道并手动修改来手动执行聚合查询:

from Flask import current_app as app
from domain.yourcollection import my_eve_aggregation #  Import the aggregation definition

# Get the aggregation pipeline
pipeline = my_eve_aggregation['datasource']['aggregation']['pipeline']

# Replace parameters - you need to manually replace the correct stages
pipeline[0]['$match'] = {'_id':'5fa904807d3037e78023a5192','time':1604827480260}

# Get the mongo collection
datasource = my_eve_aggregation['datasource']['source']

# Set db collection
col = app.data.driver.db[datasource]

result = list(col.aggregate(pipeline))
请在上为缺少的功能创建一个问题