[SERVER-52634] Transactional bulkWrite error returns only 1 error Created: 05/Nov/20 Updated: 27/Oct/23 Resolved: 09/Nov/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication, Write Ops |
| Affects Version/s: | 4.2.3, 4.4.1, 4.2.10 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Dmitry Kizilov | Assignee: | Edwin Zhou |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL | ||||||||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||||||||
| Participants: |
| Description |
|
Problem pretty same as in There is only one BulkWriteError with dup key after inserting duplicated data within a transaction, even if data contain many of them. Problem reproduces with Mongo version 4.2.3, 4.2.10, 4.4.1. No info regarding another versions.
|
| Comments |
| Comment by Oscar Calderon [ 21/Jan/22 ] |
|
Agreed that it is intended (according to the documentation), but it is not useful. Why not returning all the errors instead of a single one? I would like to have a list of errors to be able to process them later in a correct way, instead of retrying just to find out the second error, and so on. |
| Comment by Edwin Zhou [ 09/Nov/20 ] |
|
Thank you for your ticket submission. My investigation leads me to believe that the behavior you described, i.e. only a single document is returned in the BulkWriteError, is intended. This is further detailed in the Error Handling inside Transactions section of the db.collection.bulkWrite() docs:
This tells me that as soon as a duplicate error is reached inside of a transaction, there are no further attempts to insert additional documents, preventing further discovery of duplicates. Best, Edwin |