0
query.addCriteria(Criteria.where("key").regex( Pattern.compile(key, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)));

It was working fine for me. but its working only for a single query . I want my whole mongo template to work like this.

Raghav
  • 388
  • 1
  • 12
  • Possible duplicate of [MongoDB: Is it possible to make a case-insensitive query?](https://stackoverflow.com/questions/1863399/mongodb-is-it-possible-to-make-a-case-insensitive-query) – Kenster Nov 09 '17 at 12:44
  • @Kenster Above solution is to make case insensitive for specific query . i have a Spring mongo application and i want my whole application to treat every query case insensitive. To write regex pattern matching for individual query not seems to be good approach. – Sourav Sharma Nov 09 '17 at 13:13

0 Answers0