I have a Neo4j database and I want to find any properties, in any nodes, that have a string value ending in ".0".
So: for all string properties in the database, regardless of the labels, I want to find the ones that contain at least one value ending in ".0". The desired return value is a list of property names.
Is it possible to do this with a Cypher query?
This returns the distinct names of properties whose value (in any node) ends in '.0':
MATCH (n)
UNWIND KEYS(n) AS propName
WITH propName
WHERE n[propName] ENDS WITH '.0'
RETURN DISTINCT propName
The time complexity is O(N)
, where N
is the number of nodes.
This query only tests properties that actually exist in each node (instead of testing each node for all properties that exist in any node or relationship).