Best approach for handling multitenancy in mongodb using mongoose

Hi All,

Currently we are using mongoose and the below connection string

db.useDb(dbName, { useCache: true, noListener: true });

to connect to our multitenant Databases in our microservice architecture. As per this approach the db is not closed. Will this cause memory leaks during production? Is there any other better way to enhance the current flow?

3 Likes