Re: Regex : Spring data: Mongodb : Help required

329 views
Skip to first unread message

Jeff Yemin

unread,
Jan 31, 2013, 1:00:51 PM1/31/13
to mongod...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages