-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 2.2
-
Component/s: None
-
None
-
Minor Change
>>> from pymongo import Connection >>> from bson.objectid import ObjectId >>> c = Connection(safe=True) >>> c.test.foo.insert({'_id':1}) 1 >>> c.test.foo.insert({'_id':1}, safe=False)
Expected: no error, because 'safe' is False
Actual: DuplicateKeyError.
update() and insert() can be expected to override the collection's, database's, and connection's 'safe' setting same as for 'w' and other getLastError options, but don't for safe=False; only for safe=True.
Also, at least in Python 2.7.1,
Connection(wtimeout=1000, safe=False).safe
is False, but should be True. The final value of 'safe' when a Connection, Database, or Collection is given safe=False and getLastError options is unpredictable.