Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subcollections implemented in a way that prevents multiple hasmany relationships with the same model #619

Open
knownasilya opened this issue Jun 27, 2020 · 0 comments

Comments

@knownasilya
Copy link
Contributor

Currently a subcollection is queried by the model name and not the relationship name:

// models/idea.js
outline: hasMany('outline-item', { subcollection: true })

Would call findHasMany and look for the subcollection outlineItems under the idea collection. This is an issue, because what if I wanted to do:

// models/idea.js
primaryOutline: hasMany('outline-item', { subcollection: true }),
secondaryOutline: hasMany('outline-item', { subcollection: true }),

It would not work, because both would get the same items. So the subcollection should be based on the name of the relationship instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant