Compare commits
1 Commits
master
...
revert-160
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23ca8ad2be |
@ -149,19 +149,8 @@ def _merge_command(
|
||||
|
||||
def _raise_bulk_write_error(full_result: _DocumentOut) -> NoReturn:
|
||||
"""Raise a BulkWriteError from the full bulk api result."""
|
||||
# retryWrites on MMAPv1 should raise an actionable error.
|
||||
if full_result["writeErrors"]:
|
||||
full_result["writeErrors"].sort(key=lambda error: error["index"])
|
||||
err = full_result["writeErrors"][0]
|
||||
code = err["code"]
|
||||
msg = err["errmsg"]
|
||||
if code == 20 and msg.startswith("Transaction numbers"):
|
||||
errmsg = (
|
||||
"This MongoDB deployment does not support "
|
||||
"retryable writes. Please add retryWrites=false "
|
||||
"to your connection string."
|
||||
)
|
||||
raise OperationFailure(errmsg, code, full_result)
|
||||
raise BulkWriteError(full_result)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user