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

Default WriteConcern does not override in get_database, get_collection, with_options

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7
    • Affects Version/s: 3.4, 3.5, 3.6
    • Component/s: None
    • Labels:
      None
    • Minor Change

      Since PYTHON-1101 made the default write concern (WriteConcern()) evaluate to False it is not possible to override a write concern with the default.

      >>> client = MongoClient(w="majority")
      >>> client.write_concern
      WriteConcern(w=majority)
      >>> client.get_database("test", write_concern=WriteConcern()).write_concern
      WriteConcern(w=majority)
      >>> WriteConcern() or WriteConcern(w='majority')
      WriteConcern(w=majority)
      

      I propose we just remove the __bool__ and __nonzero__ methods as the behavior it causes is not intuitive. This would be a minor change in behavior that I bet no one externally relies on.

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

              Created:
              Updated:
              Resolved: