In our Node js backend application we are facing intermittent issue with Mongodb connection. It throws below error.
MongooseError: Connection was force closed
at NativeCollection.<computed> [as findOne] (/app/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:112:21)
at NodeCollection.findOne (/app/node_modules/mquery/lib/collection/node.js:34:21)
at model.Query.<anonymous> (/app/node_modules/mongoose/lib/query.js:2542:20)
at model.Query._wrappedThunk [as _findOne] (/app/node_modules/mongoose/lib/helpers/query/wrapThunk.js:29:8)
at /app/node_modules/kareem/index.js:497:25
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
It is happening from last month and it gets resolved after few minutes by itself.
Node v18.14.0
Mongoose 6.2.3
Not sure what is causing this issue. Please HELP.