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

Default WriteConcern does not override in get_database, get_collection, with_options

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.4, 3.5, 3.6
    • 3.7
    • None
    • None
    • Minor Change

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: