code: public static Map<String,Object> escapeInjections(Map<String,Object> m){
          if(m==null)
              return null;
          return Objects.iterate(m, new Closure<ObjectIterator.IterateBean, Object>() {
              @Override
              public Object call(ObjectIterator.IterateBean input) {
                  if(input.getValue() instanceof Map){
                      Map<String,Object> o = (Map<String,Object>)input.getValue();
                      o.remove("$where");
                  }
                  return input.getValue();
              }
          });
      }
docs: Remove $where commands from custom query (use it in Table)
  @return