Skip to content

Array of objects cannot be used as parameter: Invalid input 'n': expected #59

Open
@mstimvol

Description

@mstimvol

When I do the following:

  const rg = new Graph('mygraph')
  try {
    await rg.query('UNWIND $names AS name RETURN name.firstName', {
      names: [{ firstName: 'Alice' }, { firstName: 'Bob' }]
    })
  } catch (e) {
    console.error(e)
  }

I'm getting the following error:

ReplyError: errMsg: Invalid input 'n': expected ';', a statement option, a query hint, a clause or a schema command line: 1, column: 1, offset: 0 errCtx: names=[[object Object], [object Object]] UNWIND $names AS name RETURN name.f... errCtxOffset: 0
at parseError (\node_modules\redis-parser\lib\parser.js:179:12)
at parseType (\node_modules\redis-parser\lib\parser.js:302:14) {
command: 'GRAPH.QUERY',
args: [
'blockchain',
'CYPHER names=[[object Object], [object Object]] UNWIND $names AS name RETURN name.firstName',
'--compact'
]
}

I guess the error occurs because [[object Object], [object Object]] is passed to the cypher query.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions