Skip to content

Params doesn't seem to work when passing inside WHERE query #215

@nabilzhafri

Description

@nabilzhafri

Hi, when I query using attribute filter, it'll work fine. For example:

const query = [
   'MATCH (user:User {email: {email}})',
   'RETURN user'
].join('\n')

const params = {
   email: '[email protected]' // assume email exists
}

But when I passed inside WHERE statement, it doesn't seem to work:

const query = [
   'MATCH (user:User)',
   'WHERE email = {email}',
   'RETURN user'
].join('\n')

const params = {
   email: '[email protected]' // assume email exists
}

I needed this because I need to create query to find node by id.
At the moment, my workaround is to concat directly to the query, which is not recommended:

const query = [
   'MATCH (user:User)',
   'WHERE id(user) = ' + id,
   'RETURN user'
].join('\n')

Just wondering is this behavior expected? Because I read the documentation this should be supported.
Refer: http://neo4j.com/docs/developer-manual/current/cypher/syntax/parameters/

Metadata

Metadata

Assignees

No one assigned

    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