Validate a replacement document.
(replacement: Mapping[str, Any])
| 593 | |
| 594 | |
| 595 | def 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 | |
| 605 | def validate_ok_for_update(update: Any) -> None: |
no test coverage detected