I have the following filter for my mongodb:
"{'shortname': '/.*LKH.*/'}"
I use it with the following java code:
BasicQuery c = new BasicQuery(filter);
Iterable<Hospital> hospitals = template.find(c,Hospital.class);
I am getting no results, because of the surounding ' at the regular expression. If i execute the filter without the '' around the regex, i get results in mongodb. I tried different verisons but could not succeed. The filter i´m appliying must be generic, so i cannot have some parsing.
Has someone an idea how i can use a generic filter for MongoDB with the MongoTemplate in Java - or how i have to write my filter?