Search nodejs with regex and case insensitive
I recently needed to search for documents in mongo using mongoose. I knew I needed a regex but couldn’t figure out how to pass the case insensitive flag. We’ll here is how you do it.
var term = 'Apple'; Ideas.find({'title' : new RegExp(term, "i")}, function(err, ideas){...});