The question "how can I do a case insensitive find in mongo" seems to be mostly answered along the lines of "use a regex". This is fine if your search string is known in advance (/foo/
), or is known not to contain regex operators (^.+*$/\-()[]
...).
In my case, I want to do a case insensitive search on email addresses, which can contain dots and plusses. "Regex escaping" the string is certainly possible, but even if there was a standard "Regex.escapeString
" function (which there isn't), it's already starting to feel difficult to explain and maintain for such a simple problem.
Is there a way to do a case insensitive match in mongo without using regex?