Fix query transformation regarding special operators

This commit is contained in:
Johnny Chang
2020-08-04 00:30:15 +08:00
parent 4f188655d0
commit 3e1c83f8fa
2 changed files with 33 additions and 0 deletions

View File

@@ -773,6 +773,9 @@ class EmbeddedDocumentField(BaseField):
def prepare_query_value(self, op, value):
if value is not None and not isinstance(value, self.document_type):
# Short circuit for special operators, returning them as is
if isinstance(value, dict) and all(k.startswith('$') for k in value.keys()):
return value
try:
value = self.document_type._from_son(value)
except ValueError: