If you’re using a custom setter on a Sequelize model to give you object storage using a text field that holds JSON, it looks something like this.

const User = sequelize.define('user', {
  username: DataTypes.STRING,
  attrs: {
    type: DataTypes.TEXT,
    get: function (value) {
      return JSON.parse(this.getDataValue('attrs') || '{}');
    },
    set: function (value) {
      this.setDataValue('attrs', JSON.stringify(value));
    }
  }
});

In practice, when you are working with a record, you might try something like this.

let record = await db.User.findOne({ where: { username: 'neo' } });
record.attrs = { foo: 'foo' };
await record.save();

The problem you’ll run into is that setting the object this way won’t fire off the setter. You’ll also lose your existing data if you don’t merge it. This way works better.

record.attrs = Object.assign(record.attrs, { foo: 'foo' });