我的查询在mongo shell上运行正常。但是当通过pymongo运行时给出错误。有人可以帮我吗?
db.collectioname.aggregate([
{ "$match": { "$and": [
{ "organization_id": int(organization_id) },
{ "resulttime":{
"$gte":stdate,
"$lte":enddate
}
}
]
}
},
{ "$skip" : int(offset) },
{ "$limit" : int(limit) },
{ "$group": {
"_id": "$userid",
"max_temperature": { "$max": "$temperature" },
"min_temperature": { "$min": "$temperature" }
}}
])
但是,我收到一个错误,表示为>>
pymongo.errors.OperationFailure: unknown operator: $max
我的查询在mongo shell上运行正常。但是当通过pymongo运行时给出错误。有人可以帮我这个忙吗? db.collectioname.aggregate([{“” $ match“:{” $ and“:[...
我尝试过;这对我来说可以。您能否确认此示例代码有效。如果没有,则显示完整的堆栈跟踪。
完整的堆栈跟踪如下: