-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.1
-
Component/s: None
-
None
-
Environment:Linux Mint x64, MongoDB and Pymongo 3.2.1
I just upgraded my MongoDB and Pymongo to the latest version 3.2.1 to be able to use the UpdateResult object after calling update_one(). But for some reason the returned object has one field that contains an AttributeError.
Take a look at my Pycharm screen. You can see that UpdateResult_acknowledged appears as:
'Traceback (most recent call last):
File "/opt/pycharm-community-5.0.4/helpers/pydev/pydevd_resolver.py", line 191, in _getPyDictionary
attr = getattr(var, n)
AttributeError: UpdateResult_acknowledged'
It causes me a problem since I am trying to catch all exceptions and every time I need to use update_one() in my code I get this exception.
A snippet of my code is attached.
Luckily I was able to find a workaround that doesn't cause this exception to be raised. Instead of using update_one(), I can use the deprecated function update() which returns only the RAW result from MongoDB and then instead of comparing updateResult['modified_count'], I can just compare updateResult['nModified'].
But this is definitely not a best practice to use deprecated functions... Any thoughts?