Skip to content

How to pass array of objects in replacement #14543

Discussion options

You must be logged in to vote

Try this:

const result = await sequelize.query('SELECT id FROM `testTable` WHERE (name, version) IN (:data)', {
  replacements: [
    ['test1', 1],
    ['test2', 2],
  ],
  // ... other options
});

It should produce this query:

SELECT id FROM `testTable` WHERE (name, version) IN (('test1', 1), ('test2', 2))

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rohitpatil7892
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #14532 on May 25, 2022 06:39.