Below is my mongoose model and I read data from db via cursor. My cursor times out after 10 minutes as mentioned in the documentation.
const cursor = this.importRecordModel.find().cursor()
I am trying to add below to the end of the cursor but either because of typescript or mongoose, It is not on the available functions list.
.addCursorFlag('noCursorTimeout', true);
I'm assuming you're using @mongoose/types if not correct me and tell me which types file you're using.
The types file is not 100% updated correctly, as you can see
addCursorFlag
is only available for an aggregation cursor althoughmongoose
does have support forQueryCursor
addCursorFlag
as seen here.I recommend you just add
//@ts-ignore
on top of it and move on. if you want to open aPR
and add missing methods to that library you're also welcome to.Personally I dumped
mongoose
over a year ago and never looked back. I encourage other people to do the same.