node.js - Cypher Query Return matched Nodes and optional relationships -


i trying find optimal way of returning matched nodes , relationships might have?

here's problem:

i need return users created project, so

match (u : user)-[r:create]->(p: project) return u, collect(p) 

simple enough, user have other relationships , include them or optionally check (return true/false)

for example user have relationship recommend, don't want limit it, if check if exists node?

ideally return table this:

user1 - project(s) - recommended user

user2 - project(s) - null (nobody recommending)

optional match match pattern , return null if not exist

match (u : user)-[r:create]->(p: project)  optional match (u)-[:recommend]->(rec) return u, collect(p), collect(rec) 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -