MATCH (m:Movie)
WHERE size((m)<-[:DIRECTED]-()) >= 10
RETURN m.title AS title, [(m)<-[:DIRECTED]-(d) | d.name] AS directors, [(m)<-[:RATED]-(u) | u.name] AS reviewers;
match (m:Movie)<-[:DIRECTED]-(p)
with m, count(p) as count
where count > 9
match (m)<-[:DIRECTED]-(p)
with m, collect(p.name) as directors
match (m)<-[:RATED]-(u)
return m.title as title, directors, collect(u.name) as reviewers
MATCH (n:Movie)
WHERE size((n)<-[:DIRECTED]-()) >= 10
WITH n { .title,
directors: [ (n)<-[:DIRECTED]-(p) | p.name],
reviewers: [ (n)<-[:RATED]-(g) | g.name]
}
RETURN n.title AS title, n.directors AS directors, n.reviewers AS reviewers
I've just started learning Neo4j and I'm currently completing the Intermediate Cypher Queries course when I saw the challenge and decided to share this.