How can I connect to mongodb using express without mongoose?
问题 I am using the express framework and would like to connect to a mongodb without using mongoose, but with the native nodejs Mongodb driver. How can I do this without creating a new connection every time? To handle get or post requests I currently open a new connection to the db for every request and close it on completion of the request. Is there a better way to do this? Thanks in advance. 回答1: Following the example from my comment, modifying it so that the app handles errors rather than