MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _get_wce_doc

Function _get_wce_doc

pymongo/helpers_shared.py:303–314  ·  view source on GitHub ↗

Return the writeConcernError or None.

(result: Mapping[str, Any])

Source from the content-addressed store, hash-verified

301
302
303def _get_wce_doc(result: Mapping[str, Any]) -> Optional[Mapping[str, Any]]:
304 """Return the writeConcernError or None."""
305 wce = result.get("writeConcernError")
306 if wce:
307 # The server reports errorLabels at the top level but it's more
308 # convenient to attach it to the writeConcernError doc itself.
309 error_labels = result.get("errorLabels")
310 if error_labels:
311 # Copy to avoid changing the original document.
312 wce = wce.copy()
313 wce["errorLabels"] = error_labels
314 return wce
315
316
317def _check_write_command_response(result: Mapping[str, Any]) -> None:

Callers 3

_merge_commandFunction · 0.90
_merge_commandFunction · 0.90

Calls 2

copyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected