Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 我可以用sequelize insertOrUpdate获取新插入的id吗?_Node.js_Sequelize.js - Fatal编程技术网

Node.js 我可以用sequelize insertOrUpdate获取新插入的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

如何使用以下续集获取新插入的id?它当前返回一个布尔值

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”);
有关更多详细信息: