Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.
This repository was archived by the owner on May 19, 2025. It is now read-only.

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

@knownasilya

Description

@knownasilya

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions