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

Function validate_ok_for_replace

pymongo/common.py:595–602  ·  view source on GitHub ↗

Validate a replacement document.

(replacement: Mapping[str, Any])

Source from the content-addressed store, hash-verified

593
594
595def validate_ok_for_replace(replacement: Mapping[str, Any]) -> None:
596 """Validate a replacement document."""
597 validate_is_mapping("replacement", replacement)
598 # Replacement can be {}
599 if replacement and not isinstance(replacement, RawBSONDocument):
600 first = next(iter(replacement))
601 if first.startswith("$"):
602 raise ValueError("replacement can not include $ operators")
603
604
605def validate_ok_for_update(update: Any) -> None:

Callers 4

add_replaceMethod · 0.90
add_replaceMethod · 0.90
add_replaceMethod · 0.90
add_replaceMethod · 0.90

Calls 3

validate_is_mappingFunction · 0.85
nextFunction · 0.85
iterFunction · 0.85

Tested by

no test coverage detected