Hello vadimdemeds:
I was facing a Problem when I tried to connect/disconnect to db in each request. An Exception was thrown with message " MongoError: Topology was destroyed". My code may look like:
//with Express
app.get(async function(req,res){
await Mongorito.connect('...where my mongodb address is ')
const order = await Order.findOne() // without this, the problem disappered
await Mongorito.disconnect()
res.end()
})
Am I using it wrong? I tried to find out what happened in your code, and I also want to know how to manage the connections pool, but I can't find anything related in your library and homepage. Now I only use Mongorito.connect one time when the server is started, and never close the connect with mongodb (never call Mongorito.disconnect). I am not sure that my solution is ready for production, what should i do, is there any better solution to this problem, could you help me out?
Hello vadimdemeds: I was facing a Problem when I tried to connect/disconnect to db in each request. An Exception was thrown with message " MongoError: Topology was destroyed". My code may look like:
Am I using it wrong? I tried to find out what happened in your code, and I also want to know how to manage the connections pool, but I can't find anything related in your library and homepage. Now I only use
Mongorito.connect
one time when the server is started, and never close the connect with mongodb (never callMongorito.disconnect
). I am not sure that my solution is ready for production, what should i do, is there any better solution to this problem, could you help me out?