Skip to content

Error: Only HasMany associations support include.separate #824

@eamora-ab

Description

@eamora-ab

Issue Description

The documentation regarding "Separate eager-loading queries" implies that the separate: true option is a valid solution for BelongsToMany associations, but using it throws an error.

What was unclear/insufficient/not covered in the documentation

In the Separate eager-loading queries section, the text groups HasMany and BelongsToMany together when explaining performance issues with joins.

It immedately follows that up with: "To avoid this, you can use the separate option."

Because they are grouped together in the problem description, it sounds like separate is the solution for both. However, trying this on a BelongsToMany asociation results in: Error: Only HasMany associations support include.separate

The docs currently don't mention that this option is restricted to HasMany only.

If possible: Provide some suggestion on how we can enhance the docs

It would be clearer if we added a note explicitly stating that separate is currently HasMany only, or update the phrasing so BelongsToMany isn't grouped into the sentence introducing the solution.

Additional context
Link to the section: https://sequelize.org/docs/v7/querying/select-in-depth/#separate-eager-loading-queries

Metadata

Metadata

Assignees

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