Skip to content

How to prevent inner join when querying #6242

Closed

Description

@JasonFang93

Hi~
Two models is associated by belongsToMany function, eg: Project.belongsToMany(User, { through: UserProject }) , I can get all user datas which are associated with the project by project.getUsers() . However, the join table will be selected by inner join at the same time. I hope to prevent that.
AnyOne, who can help me ? Thanks inadvance.

Activity

  1. mickhansen commented on Jul 7, 2016

    @mickhansen
    Contributor

    Join table has to be selected by inner join, otherwise you can get inconsistent data with paranoid join tables.

    Not possible to disable, not sure why you'd need to (it should be scoped so it doesn't have any effect on the rest).

    Show SQL you think might be incorrect.

  2. mickhansen commented on Jul 7, 2016

    @mickhansen
    Contributor

    @JasonFang93 Not sure i understand

  3. JasonFang93 commented on Jul 7, 2016

    @JasonFang93
    Author

    That is to say, I hope to reduce the size of the data which I have selected. I get. Thanks ~

  4. JasonFang93 commented on Jul 7, 2016

    @JasonFang93
    Author

    Keeping inner join when select, the data of userProjects table(not users or projects) doesn't be returned when i select. Can do this by some settings? @mickhansen

  5. mickhansen commented on Jul 7, 2016

    @mickhansen
    Contributor

    include.through.attributes = [] is supposed to work, but doesn't atm (needs to be fixed)

  6. JasonFang93 commented on Jul 7, 2016

    @JasonFang93
    Author

    Thanks , let me try~ @mickhansen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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