Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2436

Consider allowing zero-document inserts

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: API, Query Operations
    • None
    • Fully Compatible

      This is a follow-up of JAVA-2434. Currently, providing a zero-length list or array to either DBCollection#insert or MongoCollection#insertMany yields an IllegalArgumentException. The question is whether the API can be relaxed to allow such empty inserts.

      Rationale: the collection of documents inserted is generally dynamic, and may in fact be empty in some contexts. As it stands, callers must thus make sure to check for emptiness. It'd be nice if this "burden" can be pushed into the API, as it's easy to forget to add this check.

      If implementing this feature request turns out to be infeasible, then I'd like to ask that the documentation on these methods be updated to clearly indicate that the input must be nonempty.

            Assignee:
            Unassigned Unassigned
            Reporter:
            Stephan202 Stephan Schroevers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: