我在pymongo中使用python3.10。我想获得执行时间,我不想使用time.time或类似的库,因为我只想要查询时间
pipeline_ref3 = [
{"$match": {"TP_FAIXA_ETARIA": {"$gte": 1, "$lte": 10}}},
{"$lookup": {"from": "prova", "localField": "id_prova", "foreignField": "_id", "as": "dados_prova"}},
{"$project":{"TP_FAIXA_ETARIA": 1, "dados_prova.TX_RESPOSTAS_LC": 1, "dados_prova.TX_GABARITO_MT": 1 }}
]
db.aluno.explain("executionStats").aggregate(pipeline_ref3)
我有以下错误:
`File /usr/lib/python3/dist-packages/pymongo/collection.py:3445, in Collection.__call__(self, *args, **kwargs)
3439 if "." not in self.__name:
3440 raise TypeError("'Collection' object is not callable. If you "
3441 "meant to call the '%s' method on a 'Database' "
3442 "object it is failing because no such method "
3443 "exists." %
3444 self.__name)
-> 3445 raise TypeError("'Collection' object is not callable. If you meant to "
3446 "call the '%s' method on a 'Collection' object it is "
3447 "failing because no such method exists." %
3448 self.__name.split(".")[-1])
TypeError: 'Collection' object is not callable. If you meant to call the 'explain' method on a 'Collection' object it is failing because no such method exists.`