Skip to content

Commit 03f0f7d

Browse files
authored
Merge pull request #3612 from ronaldyonggi/patch-1
Scopes example usage jamiUsers add 'await' statement
2 parents ba20197 + 31ae98c commit 03f0f7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/13/en/part13c.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,14 +1335,14 @@ const adminUsers = await User.scope('admin').findAll()
13351335
const disabledUsers = await User.scope('disabled').findAll()
13361336
13371337
// users with the string jami in their name
1338-
const jamiUsers = User.scope({ method: ['name', '%jami%'] }).findAll()
1338+
const jamiUsers = await User.scope({ method: ['name', '%jami%'] }).findAll()
13391339
```
13401340
13411341
It is also possible to chain scopes:
13421342
13431343
```js
13441344
// admins with the string jami in their name
1345-
const jamiUsers = User.scope('admin', { method: ['name', '%jami%'] }).findAll()
1345+
const jamiUsers = await User.scope('admin', { method: ['name', '%jami%'] }).findAll()
13461346
```
13471347
13481348
Since Sequelize models are normal [JavaScript classes](https://sequelize.org/master/manual/model-basics.html#taking-advantage-of-models-being-classes), it is possible to add new methods to them.

0 commit comments

Comments
 (0)