I have a node, with a list property. The list can contain multiple similar values:
["something one", "something two", "another property", "something three"]
My goal is to find all of the nodes that have one or more 'something ...' value(s) in the property and replace all of the 'something ...' properties with the single property value 'something'.
["something", "another property"]
As I see it there are two problems:
This logic may work for you:
MATCH (n:Foo)
WHERE ANY(x IN n.list WHERE x STARTS WITH 'something')
SET n.list =
REDUCE(s = ['something'], t IN n.list | CASE WHEN t STARTS WITH 'something' THEN s ELSE s + t END )
It uses the REDUCE function to create a list with 'something' as the first element and without any other 'something...' elements.