google-code-export / morphia

Automatically exported from code.google.com/p/morphia
1 stars 0 forks source link

writing the query for ignoring the whitespaces when searching string in mongodb #372

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version are you using? (Morphia/Driver/MongoDB)

Please include a stack trace below:
i have a "student" table in mongodb
i have "Student"  class in java 
i aim is to ignore the white spaces when searching string in monodb and 
ignoring case insensitivity

I created query like this 
String name="satheessh"
Query<Student> query = creatQuery();
Pattern pattern=Pattern.compile("^"+name.trim()+"$",Pattern.CASE_INSENSITIVE);
query.criteria(Student.name).equal(pattern);
Student s=null;
s=findOne();

the above query is working for only caseinsensitiv with exact match I need to 
fix for ignoring the white spaces also
 note: Pattern.COMMENTS not working .
how do i do 
thanks in advance

Original issue reported on code.google.com by satheesh...@gmail.com on 1 Feb 2012 at 3:03

GoogleCodeExporter commented 9 years ago
This is a server issue. Please open an issue there.

Original comment by scotthernandez on 8 Feb 2012 at 6:12