B
B
Bogdan2019-07-19 15:04:11
JavaScript
Bogdan, 2019-07-19 15:04:11

Sequelize return fields on bulkCreate()?

Hello. Don't tell me. Is it possible to return fields in Sequelize with bulkCreate() ? For example, I need to return an id which is auto-incrementing?

const response = await models.Cartridge.bulkCreate([
    { quantity, active },
    { quantity, active },
    { quantity, active }
  ]);

Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Skibin, 2019-07-19
@megafax

Bulk by itself returns nothing if all is well. Try an additional request to pull out the value you need

A
Alexander Pushkarev, 2019-07-19
@AXP-dev

PostgreSQL
MySQL
docs.sequelizejs.com/class/lib/model.js~Model.html...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question