-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
Accessing a collection with a dot in its name works thus in Motor:
coll2 = collection.sub coll2 = collection["sub"]
If "collection" has any customization to its options (read concern, write concern, read preference, codec options, ...) those options should be inherited by "coll2", but instead coll2 inherits from collection's MotorDatabase object.
from pymongo import WriteConcern from motor import MotorClient coll = MotorClient().db.collection coll2 = coll.with_options(write_concern=WriteConcern(w=0)) assert coll2.write_concern == WriteConcern(w=0) assert coll.write_concern != coll2.write_concern # Collection "collection.sub". Inherits write concern from db, not from coll2! coll3 = coll2.sub assert coll2.write_concern == coll3.write_concern # Fails.
- is caused by
-
PYTHON-1524 Various Collection methods use Database options instead of Collection options
- Closed