neo4j: What is the syntax to set cypher query parameters in the browser interface?

前端 未结 4 2006
广开言路
广开言路 2020-12-09 02:21

I am trying to run queries from the neo4j browser to reproduce results from my neo4j-javascript-driver client.

What is the syntax for defining query parameters in th

相关标签:
4条回答
  • 2020-12-09 02:50

    In neo4j-browser you need type for example:

    :params {nodes: [{name: "John", age: 18}, {name: "Phill", age: 23}]}
    

    Then you can use params as usual:

    UNWIND {nodes} as node
    MERGE (A:User {name: node.name, age: node.age})
    RETURN A
    

    For clear params in neo4j-browser type :params {}.

    For additional help type :help params.

    0 讨论(0)
  • 2020-12-09 02:57

    In Neo4j-3.3.4, the cypher likes this:

    :param nodes: [{name: 'John', age: 18}, {name: 'Phill', age: 23}]
    

    Neo4j Browser result: here

    0 讨论(0)
  • 2020-12-09 03:06

    In Neo4j Browser 3.5+ you can use the Cypher Shell parameter syntax, documented here: https://neo4j.com/docs/operations-manual/3.5/tools/cypher-shell/#cypher-shell-parameters

    :param name => expression
    

    The expression must be kept on a single line.

    The expression could be a scalar or a list:

    :param foo => ['a', 'b', 'c']
    

    Maps can't be used directly with this syntax as of Neo4j 4.1. You can wrap them into a list:

    :param foo => [{name: 'Alice', age: 38, address: {city: 'London', residential: true}}] 
    

    Or you can use :params:

    :params {foo: {name: 'Alice', age: 38, address: {city: 'London', residential: true}}}
    
    0 讨论(0)
  • 2020-12-09 03:11

    In Neo4j Browser 3.5+ you can use

    :params param_name => 'param_value'
    
    0 讨论(0)
提交回复
热议问题