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

Method __call__

mongoengine/queryset/base.py:105–131  ·  view source on GitHub ↗

Filter the selected documents by calling the :class:`~mongoengine.queryset.QuerySet` with a query. :param q_obj: a :class:`~mongoengine.queryset.Q` object to be used in the query; the :class:`~mongoengine.queryset.QuerySet` is filtered multiple times with dif

(self, q_obj=None, **query)

Source from the content-addressed store, hash-verified

103 self._empty = False
104
105 def __call__(self, q_obj=None, **query):
106 """Filter the selected documents by calling the
107 :class:`~mongoengine.queryset.QuerySet` with a query.
108
109 :param q_obj: a :class:`~mongoengine.queryset.Q` object to be used in
110 the query; the :class:`~mongoengine.queryset.QuerySet` is filtered
111 multiple times with different :class:`~mongoengine.queryset.Q`
112 objects, only the last one will be used.
113 :param query: Django-style query keyword arguments.
114 """
115 query = Q(**query)
116 if q_obj:
117 # Make sure proper query object is passed.
118 if not isinstance(q_obj, QNode):
119 msg = (
120 "Not a query object: %s. "
121 "Did you intend to use key=value?" % q_obj
122 )
123 raise InvalidQueryError(msg)
124 query &= q_obj
125
126 queryset = self.clone()
127 queryset._query_obj &= query
128 queryset._mongo_query = None
129 queryset._cursor_obj = None
130
131 return queryset
132
133 def __getstate__(self):
134 """

Callers 2

allMethod · 0.95
filterMethod · 0.95

Calls 3

cloneMethod · 0.95
QClass · 0.90
InvalidQueryErrorClass · 0.90

Tested by

no test coverage detected