I am currently using Express to establish a connection with my MongoDB database:
mongodb.MongoClient.connect(mongourl, function(err, database) {
// Is there a way to switch to another database at this point?
});
In the initial setup, I have to connect to the admin database. However, once the connection is made, I need to switch to a different database.
Despite doing extensive research in the official documentation, I couldn't find a solution that aligns with my requirements.
While I am familiar with the MongoClient::open()
method, I prefer to stick with using connect()
.
Any assistance on this matter would be greatly appreciated.