I'm using mongoose last version (6.3.1) and keep getting the error: TypeError: this.myModel.find(...).cursor is not a function
when running the following function which supposed to bring from db all expired dates. (I'm using node 16, NestJS)
async getOldDates(old: Date) {
return this.myModel.find({
expires: { $lt: old },
}).cursor(); }
I tried to uninstall and install again mongoose and still doesn't work. I checked docs and syntax seems right.
What can it be?
Try removing
.cursor()
find() should just return an iterable object.