I like to to go find a user in mongoDb by looking for a user called value. The problem with:
username: \'peter\'
is that i dont find it if
The following query will find the documents with required string case insensitively and with global occurrence also
var name = 'Peter'; db.User.find({name:{ $regex: new RegExp(name, "ig") } },function(err, doc) { //Your code here... });