不要怂,就是干,撸起袖子干!

Commit 04246abd by Alexsey Committed by Sushant

docs(hooks): fix updatesOnDuplicate -> updateOnDuplicate (#9580)

1 parent 03c0c612
Showing with 5 additions and 5 deletions
......@@ -250,15 +250,15 @@ Model.beforeBulkDestroy(({where, individualHooks}) => {
Model.destroy({ where: {username: 'Tom'}} /*where argument*/)
```
If you use `Model.bulkCreate(...)` with the `updatesOnDuplicate` option, changes made in the hook to fields that aren't given in the `updatesOnDuplicate` array will not be persisted to the database. However it is possible to change the updatesOnDuplicate option inside the hook if this is what you want.
If you use `Model.bulkCreate(...)` with the `updateOnDuplicate` option, changes made in the hook to fields that aren't given in the `updateOnDuplicate` array will not be persisted to the database. However it is possible to change the updateOnDuplicate option inside the hook if this is what you want.
```js
// Bulk updating existing users with updatesOnDuplicate option
// Bulk updating existing users with updateOnDuplicate option
Users.bulkCreate([
{ id: 1, isMember: true },
{ id: 2, isMember: false }
], {
updatesOnDuplicate: ['isMember']
updateOnDuplicate: ['isMember']
});
User.beforeBulkCreate((users, options) => {
......@@ -268,9 +268,9 @@ User.beforeBulkCreate((users, options) => {
}
}
// Add memberSince to updatesOnDuplicate otherwise the memberSince date wont be
// Add memberSince to updateOnDuplicate otherwise the memberSince date wont be
// saved to the database
options.updatesOnDuplicate.push('memberSince');
options.updateOnDuplicate.push('memberSince');
});
```
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!