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

API and behavior changes for Database.command

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.0
    • None
    • None
    • Major Change

    Description

      Currently if an explicit read_preference value is not passed to Database.command the value of Database.read_preference is used. This leads to a few problems.

      • "Write" commands (insert, update, delete, findAndModify, etc) do not obey read preference and must be sent to the primary.
      • Various metadata commands that might obey read preference should generally be sent to the primary (listCollections, listIndexes, etc.)
      • Many other commands are not supported by secondary members of a replica set.

      To avoid surprising failures related to read preference, Database.command attempts to route the specified operation to a replica set member that makes sense for the operation, often completely ignoring the Database.read_preference. This makes the implementation of Database.command complicated, requires driver changes to support sending new database commands to secondaries, and hides unintentional programming mistakes from the user.

      Starting in PyMongo 3.0 Database.command will ignore Database.read_preference. It will gain an explicit read_preference named parameter set to PRIMARY by default. If the user passes a different value for read_preference it will be obeyed.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: