I have an employees database in CouchDB that has over 100k of records. I need to update the salary field for all of them. I am using nodejs and cradle and would the code below be the right way to go ? Are there any other alternatives if this is not good practice ?
var newsalary;
db.view('myviews/employees', function (err, res) {
res.forEach(function (row) {
newsalary=row.salary+5;
db.merge(row._id, {salary: newsalary},function (err, res) {}); // update self here
});
});