使用sequelize和nodejs更新多个logging?

使用node.js(v0.10.12)和sequelize(2.0.0-dev9),我想更新现有的数据库表中的属性。 从另一个SO讨论中,我能够一次只更新一个logging。 我把这个调用封装在for循环中,但是在for循环中更新了相同的logging。

有人可以帮我修改这个代码来更新所有符合search要求的logging吗? 以下是我的代码:

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() {}); } }) 

根据文档,你需要做一个BulkCreate:(未testing)

 global.db.Task.update( {Desc: 'New Upate'}, //set attribute {cd: 'match', Desc: null} //where criteria ).success(function(affectedRows) { ... });