How to use "USE KEYS" in nodejs with secure parameter?

Hello,

how can I use secure parameters when using multiple on keys values ?

  const queryResult: QueryResult = await bucket
    .scope('inventory')
    .query('SELECT name FROM `airline` USE KEYS [$1, $2, $3] LIMIT 10', {
      parameters: [''],
    })

Use this n1ql so the place holder is the whole array (including the square brackets )

'SELECT name FROM airline USE KEYS $MY_KEYS LIMIT 10'

Then make your KEYS parameter an array

options = { parameters: { MY_KEYS: [ 'key1', 'key2', 'key3' ] } }

There is a sample app here - not sure if it shows an array parameter.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.