Using Mongoose ORM for MongoDB
I've declared a mongoose static method like:
ConvoDataSchema.statics.randomItem = async function () {
const ConvoData = mongoose.model('ConvoData', ConvoDataSchema)
but later when I want to call it:
let convoData = await ConvoData.randomItem()
My linter is not aware that ConvoData
has had this magical method patched onto it by Mongoose.
How can I declare these methods such that a Linter (TSLint / VSCode Intellisense) can properly discover these methods?
from how to declare mongoose static methods that will work with ESLint
No comments:
Post a Comment