Using node.js (v0.10.12) and sequelize (2.0.0-dev9), I am wanting to update attributes within an existing database table. From anther SO discussion I am able to update only one record at a time. I encapsulated the call in a for loop but that updated the same record throughout the for loop.
Could someone help me modify this code to update all records that match the search requirements? Below is my code:
global.db.Task.find({ where: {"Cd": "match"} && {"Desc": null}
}).on('success', function(task) {
if (task) { // if the record exists in the db
task.updateAttributes({
Desc: "New Upate"
}).success(function() {});
}
})