Mongoose static methods autocompletion in WebStorm

23 views
Skip to first unread message

Joachim Hagege

unread,
Jul 5, 2016, 4:20:12 AM7/5/16
to Mongoose Node.JS ODM

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.

Reply all
Reply to author
Forward
0 new messages