##数据更新
学习了数据的保存,接下来我们就开始学习对数据的更新吧!
1.示例:obj.update(查询条件,更新对象,callback);
var conditions = {name : 'test_update'};
var update = {$set : { age : 16 }};
TestModel.update(conditions, update, function(error){
if(error) {
console.log(error);
} else {
console.log('Update success!');
}
});
更新后find一下,此时数据已经修改成功了!
结合find查询功能,去update某些数据,试试是否可以成功?