How to update a record using sequelize for node?

I have not used Sequelize, but after reading its documentation, it’s obvious that you are instantiating a new object, that’s why Sequelize inserts a new record into the db.

First you need to search for that record, fetch it and only after that change its properties and update it, for example:

Project.find({ where: { title: 'aProject' } })
  .on('success', function (project) {
    // Check if record exists in db
    if (project) {
        title: 'a very different title now'
      .success(function () {})

Leave a Comment