Using "where" in a query

Hi
i want to use “where” in order to run a function on each document, but “this” returns as undefined? i need to pass this.someField to myFunction and return true false.
Session.set(‘Deliveries’, {$and: [{delivery: “checked”}, {$where : myFunction(this)}]});
Also i would like to ask, since it’s a $and expression, would it go to the $where in that case only after checking the first argument? or the order is not necessarily from “left to right”.
thanks.

What exactly are you trying to achieve? Sessions are not collections, AFAIK you can’t use database queries on them.

right but you can use them inside collections query which is what i do. as reactive vars.

return collection.find({Session.get(‘Deliveries’), … {sort: Session.get(‘sortBasic’)});
for example.