I am trying to find the most optimal way of returning all matched nodes and any relationships they might have?
Here's my problem:
I need to return all users who created a project, so
match (u : User)-[r:CREATE]->(p: Project) return u, collect(p)
OPTIONAL MATCH will match the pattern and return null if it does not exist
MATCH (u : User)-[r:CREATE]->(p: Project) OPTIONAL MATCH (u)-[:RECOMMEND]->(rec) RETURN u, collect(p), collect(rec)