this question is very similar to another post
I basically want to use the mongodb version of the sql \"like\" \'%m%\' operator
but in my situation i\'m using
You must first quote your text and then use the compile to get a regex expression:
q.put("name", Pattern.compile(Pattern.quote(m)));
Without using java.util.Pattern.quote() some characters are not escaped.
e.g. using ? as the m parameter will throw an exception.
?
m