I found @class
(or its synonym @constructor
) works for schema properties:
/**
* @class MyClient
*/
var MyClientSchema = new mongoose.Schema({
fist_name: {
type: String
},
phone_number: {
type: String
}
});
var MyClient = mongoose.model('MyClient', MyClientSchema);
The @alias
works for methods declared the old way:
/**
* @alias MyClient.prototype.getDescription
*/
MyClientSchema.method('getDescription', function () {
return this.first_name + " " + this.phone_number;
});
However, you can mark all methods as part of MyClient
at once if you use the new way of declaring methods:
/**
* @class MyClient
* @mixes {MyClientSchema.methods}
*/
var MyClientSchema = new mongoose.Schema({ ...
/** @mixin */
MyClientSchema.methods;
MyClientSchema.methods.getDescription = function () {
return this.first_name + " " + this.phone_number;
};
All the above tested in latest WebStorm version (2018.2). It works.
Things which do not work:
- Mongoose built-in methods like
.find()
or .save()
- The
.methods
syntax highlight works but code completion doesn't.
Updates are welcome!