Decode a JSON MaxKey to bson.max_key.MaxKey.
(doc: Any, dummy0: Any)
| 782 | |
| 783 | |
| 784 | def _parse_canonical_maxkey(doc: Any, dummy0: Any) -> MaxKey: |
| 785 | """Decode a JSON MaxKey to bson.max_key.MaxKey.""" |
| 786 | if type(doc["$maxKey"]) is not int or doc["$maxKey"] != 1: # noqa: E721 |
| 787 | raise TypeError("$maxKey value must be 1: %s", (doc,)) |
| 788 | if len(doc) != 1: |
| 789 | raise TypeError(f"Bad $minKey, extra field(s): {doc}") |
| 790 | return MaxKey() |
| 791 | |
| 792 | |
| 793 | def _parse_binary(doc: Any, json_options: JSONOptions) -> Union[Binary, uuid.UUID]: |