不要怂,就是干,撸起袖子干!

Commit fab5349b by Sushant

[ci skip] (docs) document include.through option for Belongs-To-Many relations.

Fixes #2975 and #3416
1 parent 9203b73f
Showing with 13 additions and 0 deletions
......@@ -258,6 +258,19 @@ UserProjects = sequelize.define('userProjects', {
status: DataTypes.STRING
})
```
With Belongs-To-Many you can query based on **through** relation and select specific attributes. For example using `findAll` with **through**
```js
User.findAll({
include: [{
model: Project,
through: {
attributes: ['createdAt', 'startedAt', 'finishedAt']
where: {completed: true}
}
}]
});
```
## Scopes
This section concerns association scopes. For a definition of association scopes vs. scopes on associated models, see [Scopes](scopes).
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!