Added new QueryBuilder option  to specify a function to be called to determine if it should be added to the result set. Fixed error in  where  is called for each cursor but promise resolve can only be called once