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

PyMongo adds empty writeConcern to commands with Python 2

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.7
    • Affects Version/s: 3.4, 3.5, 3.6
    • Component/s: Command Ops, Write Ops
    • Labels:
      None

      Instead of omitting the writeConcern when no fields are set, PyMongo adds an empty writeConcern. This only happens with Python 2. The fix is to define the __nonzero__ method on the WriteConcern class. __nonzero__ was renamed to __bool__ in Python 3.

      Note: I don't think there is any difference on the server between calling a command with an empty writeConcern document vs omitting the writeConcern. This will just save some bytes on the network and make pymongo adhere to the read-write-concern spec.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: