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

Commit ffc59576 by Jan Aagaard Meier

[ci skip] docs(update) Use spread when getting the number of affected rows. Fixed #5620

1 parent 0b6660a7
Showing with 5 additions and 2 deletions
...@@ -161,8 +161,11 @@ Task.bulkCreate([ ...@@ -161,8 +161,11 @@ Task.bulkCreate([
{ status: 'inactive' }, /* set attributes' value */, { status: 'inactive' }, /* set attributes' value */,
{ where: { subject: 'programming' }} /* where criteria */ { where: { subject: 'programming' }} /* where criteria */
); );
}).then(function(affectedRows) { }).spread(function(affectedCount, affectedRows) {
// affectedRows will be 2 // .update returns two values in an array, therefore we use .spread
// Notice that affectedRows will only be defined in dialects which support returning: true
// affectedCount will be 2
return Task.findAll(); return Task.findAll();
}).then(function(tasks) { }).then(function(tasks) {
console.log(tasks) // the 'programming' tasks will both have a status of 'inactive' console.log(tasks) // the 'programming' tasks will both have a status of 'inactive'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!