Sequelize Model.bulkInsert 不 return 插入值
Sequelize Model.bulkInsert does not return inserted values
我有一个包含这段代码的 Sequelize 迁移脚本。
const [recipeCopies, ingredientCopies] = await Promise.all([
queryInterface.bulkInsert('recipe', recipes, {
returning: true,
}),
queryInterface.bulkInsert('ingredient', ingredients, {
returning: true,
}),
]);
console.log(recipeCopies);
documentation of bulkInsert
says that the options of bulkCreate
适用。选项 returning
记录如下。
If true, append RETURNING to get back all defined values; if an array of column names, append RETURNING to get back specific columns (Postgres only)
我传递的是 true,所以我希望取回所有定义的值。我取而代之并注销的只是“24”,新创建实体的第一个 ID。
我做错了什么?
我正在使用 MySQL 5.7 和 Sequelize 5.21.8。
如 Sequelize
文档中所述,
MySQL does not support RETURNING
用于 INSERT
语句。它只适用于 Postgres。
我有一个包含这段代码的 Sequelize 迁移脚本。
const [recipeCopies, ingredientCopies] = await Promise.all([
queryInterface.bulkInsert('recipe', recipes, {
returning: true,
}),
queryInterface.bulkInsert('ingredient', ingredients, {
returning: true,
}),
]);
console.log(recipeCopies);
documentation of bulkInsert
says that the options of bulkCreate
适用。选项 returning
记录如下。
If true, append RETURNING to get back all defined values; if an array of column names, append RETURNING to get back specific columns (Postgres only)
我传递的是 true,所以我希望取回所有定义的值。我取而代之并注销的只是“24”,新创建实体的第一个 ID。
我做错了什么?
我正在使用 MySQL 5.7 和 Sequelize 5.21.8。
如 Sequelize
文档中所述,
MySQL does not support RETURNING
用于 INSERT
语句。它只适用于 Postgres。