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 21e830d3
authored
Nov 10, 2017
by
Laurens
Committed by
Sushant
Nov 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs(querying): added examples for querying with operators (#8608)
1 parent
0047dca9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletions
docs/querying.md
docs/querying.md
View file @
21e830d
...
...
@@ -93,6 +93,22 @@ Post.findAll({
});
// SELECT * FROM post WHERE authorId = 12 AND status = 'active';
Post
.
findAll
({
where
:
{
[
Op
.
or
]:
[{
authorId
:
12
},
{
authorId
:
13
}]
}
});
// SELECT * FROM post WHERE authorId = 12 OR authorId = 13;
Post
.
findAll
({
where
:
{
authorId
:
{
[
Op
.
or
]:
[
12
,
13
]
}
}
});
// SELECT * FROM post WHERE authorId = 12 OR authorId = 13;
Post
.
destroy
({
where
:
{
status
:
'inactive'
...
...
@@ -404,7 +420,7 @@ Subtask.findAll({
// Will order by a nested associated model's created_at simple association objects.
[{
model
:
Task
,
as
:
'Task'
},
{
model
:
Project
,
as
:
'Project'
},
'createdAt'
,
'DESC'
]
]
// Will order by max age descending
order
:
sequelize
.
literal
(
'max(age) DESC'
)
...
...
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