Node.js 我可以用sequelize insertOrUpdate获取新插入的id吗?
如何使用以下续集获取新插入的id?它当前返回一个布尔值Node.js 我可以用sequelize insertOrUpdate获取新插入的id吗?,node.js,sequelize.js,Node.js,Sequelize.js,如何使用以下续集获取新插入的id?它当前返回一个布尔值 exports.update = async note => entityChildModel.insertOrUpdate(note) .catch(e => 'Error'); 您可以使用returning:true(返回自动生成的值),但它仅适用于Postgres: exports.update = async note => entityChildModel
exports.update = async note => entityChildModel.insertOrUpdate(note)
.catch(e => 'Error');
您可以使用
returning:true
(返回自动生成的值),但它仅适用于Postgres:
exports.update = async note => entityChildModel
.insertOrUpdate(note , { returning : true }) // <--- HERE
.catch(e => 'Error');
exports.update=async note=>entityChildModel
.insertOrUpdate(注意,{返回:true})/“Error”);
有关更多详细信息: