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
Just complementing @PeterBechP 's answer.
Don't forget to scape the special chars. https://stackoverflow.com/a/6969486
function escapeRegExp(string) {
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
var name = 'Peter+with+special+chars';
model.findOne({name: new RegExp('^'+escapeRegExp(name)+'$', "i")}, function(err, doc) {
  //Do your action here..
});