[JAVA-717] Bulk insert method doesn't have clear failure contract Created: 18/Dec/12 Updated: 11/Oct/18 Resolved: 11/Oct/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Documentation |
| Affects Version/s: | 2.9.3 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | eHarmony Matching | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
The JavaDoc for the bulk insert method does not describe the method's postconditions on failure: is the collection unchanged, or might the insertion have succeeded partially? In the latter case, the operation cannot be retried as-is, because there's no way to determine which documents were inserted and which were not. Ideally, the method should succeed or fail atomically – otherwise, bulk insert becomes a lot less useful. However, in the event that that behavior can't fit with Mongo's typical transactional behavior, then the operation should throw some subclass of MongoException that identifies which documents were inserted and which were not. Without an ability to identify and respond to failures, this method is not useful in a production system. |
| Comments |
| Comment by Jeffrey Yemin [ 11/Oct/18 ] |
|
MongoDB 4.0 has added transaction support, which sounds like what this ticket is asking for. |
| Comment by eHarmony Matching [ 18/Dec/12 ] |
|
(By "bulk insert methods", I mean those DBCollection insert(...) overloads that accept an array or List of DBObject.) |