question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mongoose static methods autocompletion in WebStorm

See original GitHub issue

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 and I don’t get autocompletion…

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8

github_iconTop GitHub Comments

5reactions
jhagegecommented, Jul 7, 2016

I opened a feature request in JetBrains. https://youtrack.jetbrains.com/issue/WEB-22317 Please upvote it so that they can take us seriously. Would be great to have first class support for Mongoose inside Jetbrains IDEs.

Thanks !

0reactions
vkarpov15commented, Sep 20, 2017

Nope. If anyone has expertise in webstorm they’re quite welcome to write a plugin and I’d be happy to help, but I have never even installed webstorm so I wouldnt really know where to start.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongoose static methods autocompletion in WebStorm
When doing the following in WebStorm, I cannot get autocompletion when importing a mongoose model and trying to use a static method on......
Read more >
WebStorm to autocomplete Mongoose schema fields
When we call: mongoose.model('User', UserSchema) that method generates mongoose model object. It happens on runtime. Which means that WS must ...
Read more >
Mongoose static methods autocompletion in WebStorm ...
When doing the following in WebStorm, I cannot get autocompletion when importing a mongoose model and trying to use a static method on...
Read more >
Unresolved Variable Schema When Using Webstorm - ADocLib
A NodeJS mongoose Schema Example | ObjectRocketHow to define object in array in Mongoose static methods autocompletion in WebStorm \u2013 IDEs.
Read more >
mongoose JavaScript and Node.js code examples - Tabnine
Best JavaScript code snippets using mongoose(Showing top 15 results out of 10,710) ... static async getBySlug({ slug }) { const bookDoc = await...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found