Reputation: 393
Why this code doesn't work
MATCH (n) WHERE labels(n)=~ '(?i).*SUBSTRING.*' RETURN distinct labels(n)
Type mismatch: expected String but was Collection (line 1, column 17 (offset: 16))
But this does
match n-[r]-() where type(r)=~ '(?i).*SUBSTRING.*' return distinct type(r)
Upvotes: 2
Views: 249
Reputation: 11216
labels(n)
returns a collection and not a scalar. type(r)
always returns a scalar as it is single valued.
Try labels(n)[0]
instead and it should work.
Doing case insensitive substring matching on labels is not recommended in a large data set.
Upvotes: 4