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

Commit ecffc5f5 by Mick Hansen

Merge pull request #5352 from sushantdhiman/fix-docs-3

Updated Documentation
2 parents 4627da07 0b83e424
...@@ -258,6 +258,19 @@ UserProjects = sequelize.define('userProjects', { ...@@ -258,6 +258,19 @@ UserProjects = sequelize.define('userProjects', {
status: DataTypes.STRING 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 ## Scopes
This section concerns association scopes. For a definition of association scopes vs. scopes on associated models, see [Scopes](scopes). This section concerns association scopes. For a definition of association scopes vs. scopes on associated models, see [Scopes](scopes).
......
...@@ -556,6 +556,20 @@ To include all attributes, you can pass a single object with `all: true`: ...@@ -556,6 +556,20 @@ To include all attributes, you can pass a single object with `all: true`:
User.findAll({ include: [{ all: true }]}); User.findAll({ include: [{ all: true }]});
``` ```
### Including soft deleted records
In case you want to eager load soft deleted records you can do that by setting `include.paranoid` to `true`
```js
User.findAll({
include: [{
model: Tool,
where: { name: { $like: '%ooth%' } },
paranoid: true // query and loads the soft deleted records
}]
});
```
### Ordering Eager Loaded Associations ### Ordering Eager Loaded Associations
In the case of a one-to-many relationship. In the case of a one-to-many relationship.
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!