carbon-io / carbond

MIT License
2 stars 5 forks source link

Make it easier to wield multiple MongoDB connections #162

Open rmiyashiro opened 7 years ago

rmiyashiro commented 7 years ago

After playing with the way a Carbon service connects to multiple dbs, I think it could use a bit of improvement. The main issue I have is how much has to change when you go from 1 connection to 2. With 1 connection, you're just doing "service.db". If you add another connection, "service.db" no longer works, so you have to go through all your code and change it to "service.dbs.foo". You also have to go through and add dbName: "foo" to all your MongoDB collection endpoints.

In essence, it would be nice if adding db 2 didn't mean you have to change all the code associated with db 1.

One thing that might help is being able to define a "default" connection which would be used if the db isn't explicitly specified, and would also be assigned to "service.db".