sequelize: an update with .scope doesn't work
What are you doing?
When doing an .update with a scope, the scope options are ignored. Using scope works with find and create.
User.scope('withoutPassword').update({ fields }, ...)
defaultScope: {
attributes: {
exclude: ['password']
}
},
scopes: {
withoutPassword: {
attributes: {
exclude: ['password']
}
}
}
What do you expect to happen?
Should respect the scope, or at least the defaultScope
Expected JSON output:
username
first_name
What is actually happening?
Model returns all data values, with scope being ignored
Actual JSON output:
username
password
first_name
Dialect: postgres Dialect version: 10.3 Database version: 14.14 Sequelize version: ^4.38.0 Tested with latest release: Yes (If yes, specify that version) 4.38.0
Note : Your issue may be ignored OR closed by maintainers if it’s not tested against latest version OR does not follow issue template.
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 9
- Comments: 16 (3 by maintainers)
Still an issue with
6.29.0. Docs mention that this should work.Any updates regarding this?
We’re facing the same issue. Any news on this matter?
@jackiewung It’s just some code that reproduce your issue, will help me or someone else later on to quickly test their fix