How to repair MongoEngine CursorNotFound

47 Views Asked by At

In my project, the underlying Mongodb framework used is mongoengine(github_link:https://github.com/MongoEngine/mongoengine)

import mongoengine as engine
config = (
   "mongodb://xxx:27017/xxx?authSource=admin"
)
engine.connect(host=config)

In my service, there will be a large number of queries at certain times, each query taking less than 1 secon In my log, I found that this error occasionally occurs during queries:pymongo.errors.CursorNotFound: Cursor not found (namespace: 'xx', id: xxx) Most people online say that this is because the amount of query data is too large, and there was a timeout during the operation. But my query time is very short, which is different from this situation I suspect it's a server issue, so I have shortened my idle link time. The new configuration is as follows

import mongoengine as engine
config = (
   "mongodb://xxx:27017/xxx?authSource=admin&maxIdleTimeMS=10000"
)
engine.connect(host=config)

But it has no effect, and the same problem will still occur. I'm not quite sure how to locate the problem now. Can someone help me

0

There are 0 best solutions below