apoc.meta.cypher.type

Details

Syntax

apoc.meta.cypher.type(value)

Description

Returns the type name of the given value.

Arguments

Name

Type

Description

value

ANY

An object to get the type of.

Returns

STRING

Check types using Cypher

Cypher can check types without the use of APOC.

Cypher syntax for checking a type
RETURN valueType(1.0);

For more information, see the Cypher Manual → Value type function.

Usage Examples

The example below demonstrates how to use Cypher and APOC to test types:

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(1) AS output;
valueType
RETURN valueType(1) AS output;
Results for apoc.meta.cypher.type
output

"INTEGER"

Results for valueType
output

"INTEGER NOT NULL"

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type("Michael") AS output;
valueType
RETURN valueType("Michael") AS output;
Results for apoc.meta.cypher.type
output

"STRING"

Results for valueType
output

"STRING NOT NULL"

Results for apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(true) AS output;
Results for valueType
RETURN valueType(true) AS output;
Results
output

"BOOLEAN"

Results
output

"BOOLEAN NOT NULL"

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(datetime()) AS output;
valueType
RETURN valueType(datetime()) AS output;
Results for apoc.meta.cypher.type
output

"DATE_TIME"

Results for valueType
output

"ZONED DATETIME NOT NULL"

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(["Neo4j", 2020]) AS output;
valueType
RETURN valueType(["Neo4j", 2020]) AS output;
Results for apoc.meta.cypher.type
output

"LIST OF ANY"

Results for valueType
output

"LIST<STRING NOT NULL | INTEGER NOT NULL> NOT NULL"

apoc.meta.cypher.type
RETURN apoc.meta.cypher.type(["Neo4j", "Bloom"]) AS output;
valueType
RETURN valueType(["Neo4j", "Bloom"]) AS output;
Results for apoc.meta.cypher.type
output

"LIST OF STRING"

Results for valueType
output

"LIST<STRING NOT NULL> NOT NULL"

apoc.meta.cypher.type
CREATE (node1:Person)-[rel:FRIENDS]->(node2:Person)
RETURN apoc.meta.cypher.type(node1) AS node1Type,
       apoc.meta.cypher.type(rel) AS relType,
       apoc.meta.cypher.type(node2) AS node2Type;
valueType
CREATE (node1:Person)-[rel:FRIENDS]->(node2:Person)
RETURN valueType(node1) AS node1Type,
       valueType(rel) AS relType,
       valueType(node2) AS node2Type;
Results for apoc.meta.cypher.type
node1Type relType node2Type

"NODE"

"RELATIONSHIP"

"NODE"

Results for valueType
node1Type relType node2Type

"NODE NOT NULL"

"RELATIONSHIP NOT NULL"

"NODE NOT NULL"