[MODM-98] Partial UnitOfWork clear on runtime defaultDb change Created: 08/Dec/10  Updated: 20/Dec/10  Resolved: 20/Dec/10

Status: Closed
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0ALPHA2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Vladimir Razuvaev Assignee: Jonathan H. Wage
Resolution: Invalid Votes: 0
Labels: None


Actually I am not sure if this is a bug or just ODM limitation, but there is a use-case for MongoDb which doesn't fit well with current ODM implementation.

Imagine SaaS service, where each client has his own DB. Documents and collections are all the same, except most of them are stored in different DBs, depending on context.

It works pretty well with ODM defaultDB configration setting, until you need to process data from different dbs (e.g. iterate db by db in CLI script). When you try to change default db, repositories and persisters stay there and all keep a reference to initial DB. And they don't get reset on UnitOfWork->clear(). It would be great to have runtime defaultDb switching out of the box, but if that is a problem, maybe you can advice on how this could be handled?

Comment by Jonathan H. Wage [ 20/Dec/10 ]

Hi, this is actually by design. The configuration is not something you change at runtime. I think in your case you need to be working with multiple DocumentManager instances.

Generated at Sat Oct 10 12:22:27 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.