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

Handle falsey values for "let" parameter

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      PYTHON-2957 introduces the "let" parameter to many crud methods, like this:

              if let:
                  common.validate_is_document_type("let", let)
                  command["let"] = let
      

      This is problematic because it doesn't validate falsey values:

      >>> client.t.t.delete_one({}, let=False)
      <pymongo.results.DeleteResult object at 0x1125633c0>
      >>> client.t.t.delete_one({}, let=[])
      <pymongo.results.DeleteResult object at 0x112563480>
      >>> client.t.t.delete_one({}, let=0)
      <pymongo.results.DeleteResult object at 0x1124a7fc0>
      

      We need to use if let is not None: instead.

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

              Created:
              Updated:
              Resolved: