On Tuesday, February 3, 2015 at 12:57:29 AM UTC+5:30, Valeri Karpov wrote:
I don't think that'll be a core mongoose feature. Swapping out the connection underlying a model sounds like it'll have some unpredictable behavior with things like populate().3
By this do you mean swapping out the native connection under the mongoose connection that contains the models?
I agree this could be a problem, however in multi-tenant apps (well, ours at least) all the underlying "schemas" for each tenant are identical. Do you have any specifics in mind that might cause problems?
Of course it is no great burden for the app to handle caching the results of useDb so long as the the actual underlying connection pool to the mongo servers is still being used.