issue #22244: refactor document associations

Not ready for pull yet

TODO: need a compound inverse in case of duplicate source key

resolves #1962.
Ugly: we blow through validation for these documentAssigments because what the server thinks should be a string is sometimes being represented as an object. `data.sql` will resolve this quirk specially.