question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

update not returning the instance?

See original GitHub issue

update method is not returning correctly the model instance (the query run correctly)

  this.db.models.User.update(fields, { where: { id: 2 }, returning: true})
  .then((data) => {
      console.log(data[0]); // undefined
      console.log(data[1]); // 1
  }

I’m using mariadb 10, sequelize 3.24.3

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

42reactions
SalathielGenesecommented, Mar 13, 2019

Use

model.field = value;
model = await model.save();

Thanks to @roychri who just helped me about this.

11reactions
janmeiercommented, Oct 26, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

Sequelize Update Returning Before and After Results
afterRec doesn't return a value; it's not being set for some reason 2. The update is still executing last. I see the two...
Read more >
AWS::EC2::Instance - AWS CloudFormation
If the stack update fails, AWS CloudFormation uses the old instance to roll back the stack to the previous working state. The old...
Read more >
Does adding a return type to an update method violate the ...
I want the Update method to return a new instance of Employee with the updated data, but since now I can say the...
Read more >
Return types for update methods in the Data interface - IBM
This table shows the return types for each update method in the Data ... When the returnClass is not an Object[] , this...
Read more >
QuerySet API reference | Django documentation
Returns a new QuerySet containing objects that do not match the given lookup parameters. ... exclude() , filter() , order_by() , and update()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found