Skip to content

Many-to-One unique relationshipΒ #17

@Floriferous

Description

@Floriferous

I'm trying to get a cache working where the relationship is "many-to-one unique", but I think this package doesn't handle it. Here's an example:

I have a collection of Authors, and a collection of Comments. The authors store an array of commentIds, and I want each comment to denormalize the author, without it being an array.

Authors // { commentIds: ['commentId1', 'commentId2'] }

// What I want
Comments: // { authorCache: { _id: 'authorId', name: 'John' } }

// What I get
Comments: // { authorCache: [{ _id: 'authorId', name: 'John' }] }

Usually many-to-one means there can be many authors linking to the same comment, but that's not the case here, so the cache is not correct.

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