morphia
morphia copied to clipboard
@Reference DBRef should include $db
Hello my friends, keep up the awesome work!
Please, take a look that this issue and proposed solution in the link. Could it be fixed?
https://code.google.com/p/morphia/issues/detail?id=233
Being brief about this, storing the $db would save a lot of work when dealing with cases of a createdBy field reference a user from another db. Say the admin is from default domain, if he creates a user in domaina, dbref should store the db so a user from defaultdomain can be referenced in a users collection from db domaina.
In short its this structure:
defaultdomain users
domaina users
domainb users
I hope it is possible. Thanks a lot.
something tells me the Key object will need to be modified to carry a ref to the db name or obejct to accomplish this, it also assumes your using 2 distinct datastore instances. you should also reallly check to see if you need a seperate db ust for a single collection.
The separate dbs are due to application logic, but the DBRefs storing the $db reference is already available in mongodb interface, just not available via Morphia. Please take a look: http://api.mongodb.org/java/current/com/mongodb/DBRef.html
ill look over this while im traveling this week, gives me something todo while wait for connection flights