Does such a thing exist or do I follow standard Mongoose procedure?
I read the docs, I spent the whole day yesterday for this, but I could only find relative ones that placed the functions inside the service component. This is not effective as if I would like to use a static model function outside of the service component (say, a custom decorator), it wouldn't reach it as DI is private.
I would have created an Issue on Github for documentation request, but I feared I may have overlooked something.
Edit 2: Please do not change the title of the post. "Nest" is not a typo for "best". It is referring to a Node.js framework called Nest.js. (See post tags and referenced documentation link)
Edit: In the MongoDB section of the docs, there's this piece of code:
constructor(@InjectModel(CatSchema) private readonly catModel: Model<Cat>) {}
but specifically, this Model<Cat>
part, imports Cat
from an interface that extends Mongoose Document
interface. Wouldn't it be better if this Cat
interface was a class instead which was capable of functions (even after transpilation)?