Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-805

Remove per-helper read_preference parameter; add Collection.with_options.

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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()
      

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: