I have following code
await tbl.bulkCreate(response.data, {
ignoreDuplicates: true
});
in response.data there is array of object.
What I expect it should check all the fields found duplicate do not insert, What I am think it working like if Id exist ignore
I Think this ignoreDuplicates is not working due to id field which is always new for new record
Is there anyway I can say that check certain fields if that exist do not insert else insert
Thanks
Ignore duplicate values for primary keys? (not supported by MSSQL or Postgres < 9.5) check your postgres version or you can use
{updateOnDuplicate : true}
try with composite key
queryInterface.addConstraint('Items', ['col1', 'col2'], {
type: 'unique',
name: 'custom_unique_constraint_name'
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.