You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With relational DB, a 1-N relation only need a foreign key to retrieve relation content on both side. With documents DB a search on a foreign key is non efficiant.
My proposal is to automaticaly assign a reference on both sides.
See more details in this pull request
The text was updated successfully, but these errors were encountered:
Hey. Thanks for contributing this! I like the look of what you're doing and would like to check it out as soon as possible.
Given the atomic or non-transactional nature of CouchDB, I'm slightly reluctant to add this as a feature that is activated by default. I wouldn't want to give the false impression of consistency. There is no guarantee that both documents would be saved at the same time, even less so if there is validation on both models.
yes, I was wondering the same thing.
I was thinking of triggering back assignement only when there is an explicit usage of the :reverse_association.
About validation.
When object A is saved, it will trigger a save on object B. Any failed validation on A will block the process.
Most of the time B will come from a db read to get updated and saved.
The only problematic case I see it the creation of both object at the same time, so B can be affected to an association of A before being validated once. There is a way to detect this with B.new?, but I'm not sure about the what to do here:
trigger an exception (B need to be saved befroe being affected to A)
do not do the revert association, but it create silent inconsistency.
With relational DB, a 1-N relation only need a foreign key to retrieve relation content on both side. With documents DB a search on a foreign key is non efficiant.
My proposal is to automaticaly assign a reference on both sides.
See more details in this pull request
The text was updated successfully, but these errors were encountered: