When I query my database with a function passed in the \"$where\" clause in nodejs, it always return me all documents in the db.
For example, if I do
The context will always be that of the mongo database, since the function is executed there. There is no way to share the context between the two instances. You have to rethink the way you query and come up with a different strategy.