It looks like you are not using the proper regular expression syntax as described in
http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html, but rather, Javascript syntax.
Regards,
Jeff
On Saturday, November 17, 2012 4:14:45 AM UTC-5, Mridul Mishra wrote:
I must be doing something really stupid and need help to realize that
. I am using a simple regex
like below to find out all matching documents where short name starts
with passed name. Now somehow this does not work as no rows are returned though when i run the query on mongo db shell it returns multiple rows.
results=mongoTemplate.find(Query.query(new Criteria("short_name").regex(
"/^" + name +".*/i")), MongoInstrument.class);
Any insights?
Thanksin advance