我遇到了在桌面上复制数据的问题 例如,我有这个数据
let data = [{ name: Tope},{ name: Wale},{ name: Tope}];
models.sequelize.Promise.map(data, pValue => {
return models.User.findOrCreate({
where: {
name: pValue.name,
},
defaults: {
name: pValue.name,
organization_id: req.user.org_id
}
}).then(result => {
let resultData = result[0],
created = result[1]; // i am getting true 3x
console.log(created);
console.log(resultData.get());
})
});
我使用过这个链接,但这个流程对我不起作用 Node + Sequelize: How to check if item exists before adding? (async confusion)