Updated to pymongo 4.1.1 and upgraded mongoengine to 0.24.1 but received the following error:
pymongo/collection.py", line 1610, in find
return Cursor(self, *args, **kwargs)
TypeError: __init__() got an unexpected keyword
argument 'modifiers'
I was under the impression the latest versions would work together. Are they not compatible? The error appears in pymongo itself and not in my code.
CodePudding user response:
This pymongo
error seems to come from a removed option.
From the pymongo
API docs:
Changed in version 4.0: Removed the modifiers option. Empty projections (eg {} or []) are passed to the server as-is, rather than the previous behavior which substituted in a projection of {"_id": 1}. This means that an empty projection will now return the entire document, not just the "_id" field.
In addition, currently (2022-05-04) there seem to be several pymongo >= 4.0
issues against the mongoengine
codebase.
CodePudding user response:
Thanks for pointing that out rickhg12hs, I missed it. That means the issue is not related to the mongoengine in this case. I was able to resolve the issue by removing a modifiers parameter in a find. I would vote you up but my reputation is not high enough yet to vote.