-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Major Change
Most users who want a non-default read_preference would set that option at the Database or Collection level for use by any operation performed on that Database or Collection. Occasionally an application will want to override that setting for a specific operation. This is currently solved in PyMongo by passing parameters with varied names to individual helpers.
Remove the helper specific options and replace them with a 'with_options' helper.
For example, to change the read_preference per query in PyMongo 2.x you would do:
collection.find(read_preference=ReadPreference.SECONDARY)
After this change that would become:
collection.with_options(read_preference=ReadPreference.SECONDARY).find()