fastify-mongoose
fastify-mongoose copied to clipboard
Mutiple Databases
I need to convert a repo that uses 2 mongodb databases and 1 mySql database. How to accomplist the first goal of attaching to the mondodb databases and assinging the models?
I did some analysis for this here: https://stackoverflow.com/a/62571109/3309466
It is doable using const conn = mongoose.createConnection( instead of connect here:
https://github.com/alex-ppg/fastify-mongoose/blob/3ca860ae03eaf4191ab70c2b4763492c85cfbadc/index.js#L59
Using a connection singleton break the encapsulation of fastify so it would be a simple but huge improvements