I know maybe this is far too basic but I can't recall how to do this properly. I want to declare a Mongoose document to use VS Code IntelliSense for retrieve data.
Right now, document is declared as any since findById() returns any:
const document = await MyModel.findById(docId);
So, whenever I want to call to something like document.updateOne() I don't have intelliSense on.
I have tried using something like:
import { Model, Document } from 'mongoose';
...
const document: Model<Document> = await MyModel.findById(docId);
But this don't give me the ability to refer internal attributes directly like document.title or any other.
So, what is the proper way to declare document?