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)
| 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. |