When doing the following in WebStorm, I cannot get autocompletion when importing a mongoose model and trying to use a static method on the schema.
In one file I have my Mongoose schema defined with static methods:
userSchema.statics.saveUser = function(callback){
var user = new this();
user.save(callback);
};
And in another file I try to use these methods.
var User = require('../models/user.js');
User.saveUser(function(err, result) {
...
}
Whereas if I would type User.statics.saveUser(...
I would get autocompletion.
Do you know about a workaround ? Thanks.