I'm building a Meteor Web API using this lib, and one of the features of the Web API is that it must be able to connect any one of several databases based on a Web Request from a Meteor client.
.
I understand it's now possible to connect to multiple databases from one Server Side Only Meteor application from this SO answer (Using Multiple Mongodb Databases with Meteor.js):
It is now possible to connect to remote/multiple databases:
var database = new MongoInternals.RemoteCollectionDriver("<mongo url>");
MyCollection = new Mongo.Collection("collection_name", { _driver: database });
Yet, does this work, does it work if you have the same collection names in both databases? The databases are basically replicas, of course with different MONGO_URLs and with different data.
.
For example:
(1) A Web Request from a client would come into the Meteor Web API. That request would contain data that specified a database ID=2. I would look up that ID and match it to a database URL. I would connect to that database and pull in the collection name "People" and do processing on that data.
.
(2) Another Web Request from a different client comes into the Meteor Web API. This time with a database ID=4, the Web App looks up the database and connects to another, different, URL, and pulls in the same collection name, "People", yet this time of course it has different data (because of course it's a different database).
.
Can this work with the same collection names? If so how would that work? Also, what if I had two requests for two different database come in at the same time?