Regex comes to rescue.
Pattern: /query/i
Caveat: Regex is a performance spoilsport when it comes to millions of records esp. because Regex ignores indexes.
Possible Options:
- Use regex for not-so-huge datasets
- Or go un-normalized, store the to-be-searched-attribute in lower case as another field. Fire the search query against lowercase version of attribute thus saving yourself the performance bottlenecks caused by regex.
Reference: http://stackoverflow.com/questions/9824010/mongoose-js-find-user-by-username-like-value