Answer the question
In order to leave comments, you need to log in
Sequelize bulkCreate returns incorrect value?
Hello. Don't tell me? I am using PostgreSQL database. I have a code field that is filled in by the before trigger automatically if null.
in Sequelize create() works as it should and returns a record, with code auto-filled
const response = await models.Cartridge.create(
{ quantity, active, code: null },
{ returning: true }
);
// dataValues: {id: 5, quantity: 500, active: true, code: "090217205", updatedAt: Fri Jul 19 2019 16:35:59 GMT+0300 (Eastern European Summer Time), …}
const response = await models.Cartridge.bulkCreate(
[{ quantity, active, code: null }],
{ returning: true }
);
// [ { dataValues: {id: 7, code: null, quantity: 500, active: true, createdAt: Fri Jul 19 2019 16:48:27 GMT+0300 (Eastern European Summer T }]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question