fastify-mongoose icon indicating copy to clipboard operation
fastify-mongoose copied to clipboard

Mutiple Databases

Open johntom opened this issue 6 years ago • 1 comments

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?

johntom avatar Apr 15 '19 19:04 johntom

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

Eomm avatar Jun 25 '20 08:06 Eomm