user3696212
user3696212

Reputation: 3439

Sequelize - simple update not working

I need to update one value in one row in my PostgreSQL DB through a simple Model.update() call.

It has always worked easily, but after updating to sequelize v4 it only updates column updatedAt (that's whats in logs), nothing more.

My code:

const updatedRow = await MyModel.update(
  {name_of_column: "NEW VALUE"}, 
  {
    where: { id: SOME_ID_NUMBER },
    raw: true,
    returning: true,
  }
);

I tried all possible combinations of properties raw/returning, even fields and attributes, but nothing is working. Thanks for your help.

Upvotes: 1

Views: 1382

Answers (1)

Rastalamm
Rastalamm

Reputation: 1782

Unsure if this is it, but try switching raw: true, for plain: true.

The below comes from the upgrade to v4 docs.

"Getters wont run with instance.get({ raw: true }), use instance.get({ plain: true })"

Upvotes: 1

Related Questions