-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: 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.