I have a database with nodes having property "name" with values among the list "first_1", "first_2", "second_1", "second_2", "third_1", "third_2" (each node has only one value among these) and I want to return the nodes having the property "name" with values containing the substring "first" or "second". So the query should return all the nodes with "name" property containing either "first_1" or "first_2" or "second_1" and so on but not the ones containing "third_*". What should be the ideal Cypher query for this?
You can try this Cypher using any() function and starts with:
with ['first', 'second'] as list
match (n)
where any (item in list where n.name starts with item)
return n
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With