I am working on an application that uses several separate Mongo databases. I would like to be able interact with all of these databases using a single Mongo connection in my application. I'm currently doing this by using the underlying java objects:
But of course this means I need to interact with collections from the sister DBs differently than I do the main connection DB. I would like to be able to use the cfmongodb DBCollection object for these as well.
What I was thinking was to add an optional second argument dbName to Mongo.getDBCollection() which would return a DBCollection object pointing to the sister database collection:
Mongo.getDBCollection("collectionName","dbName");
Does this seem like a reasonable approach? Is there something I'm missing that would allow me to do this already?
I am working on an application that uses several separate Mongo databases. I would like to be able interact with all of these databases using a single Mongo connection in my application. I'm currently doing this by using the underlying java objects:
getMongoDB().getSisterDB("myotherdb").getCollection("collectionName")
But of course this means I need to interact with collections from the sister DBs differently than I do the main connection DB. I would like to be able to use the cfmongodb DBCollection object for these as well.
What I was thinking was to add an optional second argument dbName to Mongo.getDBCollection() which would return a DBCollection object pointing to the sister database collection:
Mongo.getDBCollection("collectionName","dbName");
Does this seem like a reasonable approach? Is there something I'm missing that would allow me to do this already?