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

Don't raise InvalidOperation for collection.bulk_write with zero requests

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.7.2
    • Component/s: Error Handling
    • Labels:
      None

      When executing `collection.bulk_write(requests)`, if `requests` is an empty list, a `pymongo.errors.InvalidOperation: No operations to execute` error is raised. I feel that this command should simply be a no-op. I find myself having to wrap `bulk_write` calls with e.g. `if requests:`. Why is this operation considered "invalid"? Thanks.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            dwinston Donald Winston
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: