MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / prepare_query_value

Method prepare_query_value

mongoengine/fields.py:777–790  ·  view source on GitHub ↗
(self, op, value)

Source from the content-addressed store, hash-verified

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
793class GenericEmbeddedDocumentField(BaseField):

Callers

nothing calls this directly

Calls 5

to_mongoMethod · 0.95
InvalidQueryErrorClass · 0.90
keysMethod · 0.80
_from_sonMethod · 0.80
prepare_query_valueMethod · 0.45

Tested by

no test coverage detected