调用静态方法到Mongoose中的插件中的模式

我写了一个插件做:

module.exports = function (schema, options) { schema.statics.customFunction = function (criteria) { // Code }; }; 

这是我的模式:

  var customPlugin = require('./plugin'); var customSchema = new mongoose.Schema({ // Schema }); customSchema.plugin(customPlugin, {}); var model = mongoose.model('Custom', customSchema); model.customFunction() // I have a undefined here 

如果我在插件之外编写我的静态方法,它正在工作。 这是来自mongoose的限制吗?