Skip to content
This repository was archived by the owner on Apr 17, 2020. It is now read-only.
This repository was archived by the owner on Apr 17, 2020. It is now read-only.

Validate options on a joined query #136

@joelmukuthu

Description

@joelmukuthu

Adding fields on a joined query for a count query causes an ambiguous error:

Group.count({ join: User.query.setOptions({ fields: ['id'] }) });
// rejects with:
// QueryError: Group: cannot join `User` with no primary or unique fields selected

And that error won't go away even if one selects a primary field on the parent Query:

// also fails:
Group.count({ join: User.query.setOptions({ fields: ['id'] }), fields: ['id'] });

In this case, it's a user error to add fields on a joined query, but the error message could be improved.

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