I have a node.js (and express) product administration app which connects to a mongodb database containing the produt data, and uses Stormpath for user administration.
This was all fine, but now I need the app to be able to connect to two different databases - one for UK products and one for US products. The users need to be able to switch between the UK and US databases whenever they like.
I have been able to make this work for the whole app just by adding a button which disconnects from one db and connects (using MongoClient) to the other, but what I need is to either have two connections at all times, and pick which one to use based on which country the user has selected, or to have a db connection per user.
Which is the correct way to do this sort of thing?