Hi everyone!
I want to return a list of nodes but hide certain properties from being returned. I cannot use role privileges in this case, so I somehow have to filter out the properties.
This query removes the key
from each node:
// match something
MATCH (n) WHERE n.key = "something"
// expand node into separate variables and remove the key from the proeprties
WITH id(n) as identity, labels(n) as labels, apoc.map.removeKey(properties(n), 'key') AS properties
// combine node again
WITH { identity: identity, labels: labels, properties: properties } as node
// return list of nodes
RETURN collect(node) as nodes
Now I wanted to see if there's a native Cypher way of doing that, or maybe a custom APOC procedure that I don't know of? I know there are virtual nodes from apoc.create.vNode
but they return negative ids which is not optimal for my use case.