You didn’t specify whether you were looking to define class or instance methods. Since others have covered instance methods, here’s how you’d define a class/static method:
animalSchema.statics.findByName = function (name, cb) {
return this.find({
name: new RegExp(name, 'i')
}, cb);
}