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 ecffc5f5
authored
Feb 03, 2016
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5352 from sushantdhiman/fix-docs-3
Updated Documentation
2 parents
4627da07
0b83e424
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
docs/docs/associations.md
docs/docs/models-usage.md
docs/docs/associations.md
View file @
ecffc5f
...
...
@@ -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
)
.
...
...
docs/docs/models-usage.md
View file @
ecffc5f
...
...
@@ -556,6 +556,20 @@ To include all attributes, you can pass a single object with `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
In the case of a one-to-many relationship.
...
...
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