-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.0.2
-
Component/s: None
-
None
From this comment:
A DuplicateKeyException has no logical application in the new driver, as all writes are executed through MongoDB\Driver\Manager::executeBulkWrite(). The thrown BulkWriteException might include any number of errors, which you'll need to infer from the result object. For the benefit of logging, we do concatenate all error messages into the BulkWriteException's message.
Consider adding such an exception for the library's single-write methods. When those operations execute a single-item BulkWrite, we'd need to catch the BulkWriteException and transform it into a DuplicateKeyException before re-throwing.
This may be a list of error codes to check for: https://github.com/mongodb/mongo-php-driver-legacy/blob/d4ce6992164893d185e9d1538c48857479d1554e/cursor_shared.c#L540
- is duplicated by
-
PHPLIB-225 Ensure that users can distinguish duplicate key write errors
- Closed
- links to