Open kingo999 opened 4 years ago
Unfortunately it's not possible to do that right now unless you fallback to writing the first match clause with .raw()
:
db.raw`p=(U:User {id: ${id}})-[:MEMBER_OF_GROUP|HAS_REPORT_ROLE *]->(r:Role {allowed_delete: ${true}})`
.return(....)
...
It is currently on the roadmap (#91) but I don't have a ETA
Thanks for the quick feedback. Does that also mean apoc functions like shortest path cannot be used outside of .raw ?
Yeah there is no special syntax for those.
I've created a PR for this which simply adds another Pattern
class, PathNamePattern
, to allow this.
By the way neo4j allows naming paths not only in MATCH
, but also in CREATE
and MERGE
. Though the cypher reference mentions them only for MATCH
.
Is it possible to assign a query to a variable ? For instance MATCH p=(n:Node)-[r:REL]->(x:Node) RETURN p
I would like to be able to assign to and access 'p' in the following example
db.match([ node('u', 'User', {id: '333333'}), relation('out', ['MEMBER_OF_GROUP','HAS_REPORT_ROLE'],'*'), node('r', 'Role', {allowed_delete: true}) ]).return('count(u) > 0 as authorised') .run() .then(function (results) { l.info(
Is Authorised:
+ JSON.stringify(results[0])); });