how to override function of mongoose plugin?
I faced similar issue while overriding mongoose query functions and tried something like this and it works
//store reference to original myPlugin createCustomDoc functionvar createCustomDoc = user.statics.createCustomDoc;//override that functionuser.statics.createCustomDoc = function (options, callback) { var self = this; //after your code, call original function createCustomDoc.call(self, options, callback);}