apostrophe icon indicating copy to clipboard operation
apostrophe copied to clipboard

Configuring joins is needlessly tedious

Open boutell opened this issue 10 years ago • 3 comments

{
  name: '_strategies',
  type: 'joinByArray',
  idsField: 'strategiesIds',
  label: 'Strategies',
  withType: 'strategy'
}

My thoughts:

  • idsField should default to the name of the join, less the _, plus Ids
  • idField should do something similar for joinByOne. Confusing them is common and this eliminates that as an issue
  • label should default to the pluralLabel of withType (ooooooo)

Now we have:

{
  name: '_strategies',
  type: 'joinByArray',
  withType: 'strategy'
}

So nice

If relationship is present, relationshipsField should also default. If the join is _strategies then the default relationshipsField would be strategiesRelationships.

What do you think?

boutell avatar Sep 09 '16 15:09 boutell

Generally, I would be very in favor of some smart defaults here.

idsField should default to the name of the join, less the _, plus Ids

_strategiesIds ?

agilbert avatar Sep 09 '16 16:09 agilbert

The _ needs to come off because anything with a _ is not stored back to mongodb at "update/insert" time (except for _id).

This is the convention that permits us to attach dynamically joined stuff to dumb JSON objects and yet still be able to avoid redundantly storing it back to MongoDB.

On Fri, Sep 9, 2016 at 12:25 PM, Alex Gilbert [email protected] wrote:

Generally, I would be very in favor of some smart defaults here.

idsField should default to the name of the join, less the _, plus Ids

_strategiesIds ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/punkave/apostrophe/issues/652#issuecomment-245964438, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB9fQGMcYEUFWcM1txnVc5lLg1vDyUOks5qoYh8gaJpZM4J5MBb .

*THOMAS BOUTELL, *SUPPORT LEAD P'UNK AVENUE | (215) 755-1330 | punkave.com

boutell avatar Sep 09 '16 18:09 boutell

See above. This was implemented and merged.

kerrygilbert avatar Jul 14 '17 13:07 kerrygilbert