[JAVA-2436] Consider allowing zero-document inserts Created: 27/Jan/17 Updated: 19/Apr/17 Resolved: 19/Apr/17 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API, Query Operations |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Stephan Schroevers | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Description |
|
This is a follow-up of 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. |
| Comments |
| Comment by Jeffrey Yemin [ 19/Apr/17 ] |
|
Hi Stephen, I don't see it as an unreasonable burden to requires applications to make this check themselves. Applications are in the best position to know whether an empty list of documents is a normal condition. The driver should not be hiding bugs in applications where this was done inadvertently. Also, as it stands every CRUD method in MongoCollection results in either a message sent to a MongoDB server or an exception. That's consistent and easy to understand, and I'd rather not change it. I opened |