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.

Activity

DvirDukhan

DvirDukhan commented on Jan 8, 2021

@DvirDukhan
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

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

      Participants

      @leibale@DvirDukhan@mstimvol

      Issue actions

        Array of objects cannot be used as parameter: Invalid input 'n': expected · Issue #59 · RedisGraph/redisgraph.js