Mongoose.js: Find user by username LIKE value

For those that were looking for a solution here it is:

var name="Peter";
model.findOne({name: new RegExp('^'+name+'$', "i")}, function(err, doc) {
  //Do your action here..
});

Leave a Comment