I know you can define methods on the schema
var schema = new mongoose.Schema({});
schema.methods.method = function(){}
But is there a way define methods on the model
var model = mongoose.model('entities', schema);
model.methods? = ? function?(){}?
Basically I want to write some wrappers that I can use like so:
User.findByUsername('me', function(err, user){...});
You can have statics and instance methods. In you case, you need to define static methods :
schema.statics.method = function(){}
Have a look on the doc here : http://mongoosejs.com/docs/guide.html#methods