Currently I am using WebStorm and hove something like
class MyClass {
constructor(DB) {
this.DB = DB;
}
doSomething() {
await this.DB.findOne(...);
}
}
After I connect the MongoClient from the mongodb driver, I use the collection into a MyClass instance:
const actions = new MyClass(client.db(mainDB).collection(mainDBCollection));
client is response of mongodb.MongoClient.connect()
The WebStrom shows a notification:
Unresolved function or method `insertOne()` in the doSomething function of MyClass
How to declare in JSDoc that the DB in MyClass is a instance of the collection() function which I get from the mongodb client, so that WebStorm can recognize the functions used in the this.DB/mongo collection?