How to ignore hooks?

Viewed 3069

I have following model:

sequelize.define("User", {
    id: {
        type: DataTypes.INTEGER(11),
        autoIncrement: true,
        primaryKey: true
    },
    email: {
        type: DataTypes.STRING(255),
        allowNull: false,
        unique: true,
    },
    password: {
        type: DataTypes.STRING(60),
        allowNull: false
    },
    role: {
        type: DataTypes.STRING(32),
        allowNull: false,
        defaultValue: 'user',
    }
},{

    instanceMethods: {
        verifyPassword: function(password,cb) {
            crypt.compare(password,this.password,cb);
        },
    },

    hooks: {
        beforeUpdate: hashPassword,
        beforeCreate: hashPassword,
    }

});

I would like to create it like this while ignoring beforeUpdate/Create hooks:

User.create({ email: 'admin@render.ly', role: 'admin', password: '############' },['email','password','role']).done(function(err,admin){ ... })

How?

2 Answers
Related