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 d5e9f124
authored
Jul 30, 2018
by
Ali Ismayilov
Committed by
Sushant
Jul 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs(querying): model mapping for custom fields (#9688)
1 parent
63d4aaa3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
docs/raw-queries.md
docs/raw-queries.md
View file @
d5e9f12
...
...
@@ -25,9 +25,14 @@ A second option is the model. If you pass a model the returned data will be inst
```
js
// Callee is the model definition. This allows you to easily map a query to a predefined model
sequelize
.
query
(
'SELECT * FROM projects'
,
{
model
:
Projects
}).
then
(
projects
=>
{
// Each record will now be a instance of Project
})
sequelize
.
query
(
'SELECT * FROM projects'
,
{
model
:
Projects
,
mapToModel
:
true
// pass true here if you have any mapped fields
})
.
then
(
projects
=>
{
// Each record will now be an instance of Project
})
```
## Replacements
...
...
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