apoc.any.property

Function

apoc.any.property(object ANY, key STRING) - returns the property for the given key from an object. The object can be a virtual NODE, a real NODE, a virtual RELATIONSHIP, a real RELATIONSHIP, or a MAP.

Signature

apoc.any.property(thing :: ANY, key :: STRING) :: ANY

Input parameters

Name Type Default

thing

ANY

null

key

STRING

null

Usage examples

The examples in this section are based on the following graph:

CREATE (s:Student {name: 'Alice', score: 71});
CREATE (s:Student {name: 'Mark', score: 95});
CREATE (s:Student {name: 'Andrea', score: 86});
CREATE (s:Student {name: 'Rajesh', score: 89});
CREATE (s:Student {name: 'Jennifer', score: 96});
CREATE (s:Student {name: 'Katarina', score: 80});

If we create virtual nodes containing students scores, we can use apoc.any.property to extract a property from these virtual nodes:

MATCH (s:Student)
CALL apoc.create.vNode(['Score'],{value: s.score})
YIELD node
RETURN apoc.any.property(node, "value") AS score;
Table 1. Results
score

71

95

86

89

96

80