sequelize批量新增或批量更新(bulkCreate的up
作者:
AsaGuo | 来源:发表于
2019-05-22 15:23 被阅读0次
说明:如果id存在,则update,否则insert
updateOnDuplicate:true
let obj1 = {
id:0,
name: "园区问卷调查"
};
let obj2 = {
id:1,
name: "园区问卷调查ddddddddddddddddddddd"
};
let obj_list = [obj1, obj2];
uc_survey.bulkCreate(obj_list , {updateOnDuplicate:true}).then(result => {
result.forEach(item => {
console.log("item:",item)
});
}).catch(err => {
console.log("err:",err)
});
本文标题:sequelize批量新增或批量更新(bulkCreate的up
本文链接:https://www.haomeiwen.com/subject/jkluzqtx.html
网友评论