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

Function validate_ok_for_update

pymongo/common.py:605–615  ·  view source on GitHub ↗

Validate an update document.

(update: Any)

Source from the content-addressed store, hash-verified

603
604
605def validate_ok_for_update(update: Any) -> None:
606 """Validate an update document."""
607 validate_list_or_mapping("update", update)
608 # Update cannot be {}.
609 if not update:
610 raise ValueError("update cannot be empty")
611
612 is_document = not isinstance(update, list)
613 first = next(iter(update))
614 if is_document and not first.startswith("$"):
615 raise ValueError("update only works with $ operators")
616
617
618_UNICODE_DECODE_ERROR_HANDLERS = frozenset(["strict", "replace", "ignore"])

Callers 4

add_updateMethod · 0.90
add_updateMethod · 0.90
add_updateMethod · 0.90
add_updateMethod · 0.90

Calls 3

validate_list_or_mappingFunction · 0.85
nextFunction · 0.85
iterFunction · 0.85

Tested by

no test coverage detected