Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 0f3143b7
authored
May 21, 2015
by
Bulkan Evcimen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain include.required implicitly set
* When include.where is used
1 parent
3219a9c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
docs/docs/models-definition.md
docs/docs/models-definition.md
View file @
0f3143b
...
...
@@ -1075,7 +1075,8 @@ User.findAll({ include: [{ model: Tool, as: 'Instruments' }] }).then(function(us
})
```
When eager loading we can also filter the associated model using
`where`
When eager loading we can also filter the associated model using
`where`
. This will return all
`User`
s in which the
`where`
clause of
`Tool`
model matches rows.
```
js
User
.
findAll
({
include
:
[{
model
:
Tool
,
as
:
'Instruments'
,
where
:
{
name
:
{
$like
:
'%ooth%'
}}
}]
})
...
...
@@ -1115,6 +1116,9 @@ User.findAll({ include: [{ model: Tool, as: 'Instruments', where: {name: {$like:
})
```
When an eager loaded model is filtered using
`include.where`
then
`include.required`
is implicitly set to
`true`
. This means that an inner join is done returning parent models with any matching children.
### Including everything
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment