Hi there. Sorry if I’ve not posted this on the correct forum.
I’ve got a general question about database connections to Mongo. I’m developing an app using Nodejs, Express and a local hosted MongoDB.
The first aspect is more a standard, do a query and then render the results to the browser. Which I open a DB connection, perform the query and close the connection.
The second is an AJAX element, where there could be a number of queries, in quick succession. I have read in this instance it’s best not to close the connection, as this will downgrade the performance.
My question is this, First, is that correct with an AJAX type application. Second, never closing the database connection, will this cause a problem. EG. some kind of out of memory issue when there is a lot of traffic. Or does the connection automatically close after a period of inaction.