Skip to content

Commit 31ae98c

Browse files
authored
Scopes example usage jamiUsers add 'await' statement
Current examples don't have the 'await' statement, which causes the JSON response after the .findAll() method to be empty. I believe these examples need 'await' statement to be added.
1 parent 9ba2c62 commit 31ae98c

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)