How to filter results based on relationship properties

How can I filter the result based on relationship properties.?

Use case: Get all the MOVIES and PERSONS acted in them where role was NEO.
I tried the query as below

match (p:Person)-[a:ACTED_IN]->(m:Movie{title:'The Matrix'}) where a.roles = 'Neo' return, m.title, a.roles

You were on the right track. Unfortunately the data set didn't make it easy if you're just starting out. If the property was a simply an int or a string you would have been just fine. But in the case of this data, the role isn't a string, it's actually a list. You can read up more on lists and data types here: Lists - Cypher Manual.

Here's the fix to your query:

match (p:Person)-[a:ACTED_IN]->(m:Movie{title:'The Matrix'}) 
where a.roles = ['Neo']
return *
1 Like

Thanks Michael, it works.