(self, op, value)
| 775 | return field |
| 776 | |
| 777 | def prepare_query_value(self, op, value): |
| 778 | if value is not None and not isinstance(value, self.document_type): |
| 779 | # Short circuit for special operators, returning them as is |
| 780 | if isinstance(value, dict) and all(k.startswith("$") for k in value.keys()): |
| 781 | return value |
| 782 | try: |
| 783 | value = self.document_type._from_son(value) |
| 784 | except ValueError: |
| 785 | raise InvalidQueryError( |
| 786 | "Querying the embedded document '%s' failed, due to an invalid query value" |
| 787 | % (self.document_type._class_name,) |
| 788 | ) |
| 789 | super().prepare_query_value(op, value) |
| 790 | return self.to_mongo(value) |
| 791 | |
| 792 | |
| 793 | class GenericEmbeddedDocumentField(BaseField): |
nothing calls this directly
no test coverage detected