Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mstimvol opened this issue Jan 8, 2021 · 1 comment
Assignees

Comments

@mstimvol
Copy link

mstimvol commented Jan 8, 2021

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.

@DvirDukhan
Copy link
Contributor

@mstimvol
map datatype is WIP RedisGraph/RedisGraph#1514
once it is done and map as a parameter is supported your query will be valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants