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

Class QueryCompilerVisitor

mongoengine/queryset/visitor.py:65–80  ·  view source on GitHub ↗

Compiles the nodes in a query tree to a PyMongo-compatible query dictionary.

Source from the content-addressed store, hash-verified

63
64
65class QueryCompilerVisitor(QNodeVisitor):
66 """Compiles the nodes in a query tree to a PyMongo-compatible query
67 dictionary.
68 """
69
70 def __init__(self, document):
71 self.document = document
72
73 def visit_combination(self, combination):
74 operator = "$and"
75 if combination.operation == combination.OR:
76 operator = "$or"
77 return {operator: combination.children}
78
79 def visit_query(self, query):
80 return transform.query(self.document, **query.query)
81
82
83class QNode:

Callers 1

to_queryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected