'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 evaluate your predicate clause, for each object
in the collection.
.. versionadded:: 0.5'

def where(self, where_clause):

    queryset = self.clone()
    where_clause = queryset._sub_js_fields(where_clause)
    queryset._where_clause = where_clause
    return queryset
