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

Method where

mongoengine/queryset/base.py:1550–1562  ·  view source on GitHub ↗

Filter ``QuerySet`` results with a ``$where`` clause (a Javascript expression). Performs automatic field name substitution like :meth:`mongoengine.queryset.Queryset.exec_js`. .. note:: When using this mode of query, the database will call your function, or

(self, where_clause)

Source from the content-addressed store, hash-verified

1548 return db.command("eval", code, args=fields).get("retval")
1549
1550 def where(self, where_clause):
1551 """Filter ``QuerySet`` results with a ``$where`` clause (a Javascript
1552 expression). Performs automatic field name substitution like
1553 :meth:`mongoengine.queryset.Queryset.exec_js`.
1554
1555 .. note:: When using this mode of query, the database will call your
1556 function, or evaluate your predicate clause, for each object
1557 in the collection.
1558 """
1559 queryset = self.clone()
1560 where_clause = queryset._sub_js_fields(where_clause)
1561 queryset._where_clause = where_clause
1562 return queryset
1563
1564 def sum(self, field):
1565 """Sum over the values of the specified field.

Callers 2

_cursorMethod · 0.80
test_whereMethod · 0.80

Calls 2

cloneMethod · 0.95
_sub_js_fieldsMethod · 0.80

Tested by 1

test_whereMethod · 0.64