1

According to neo4j-datatypes properties have primitive data types.

  1. How can I define the data type when I create properties. For exmple in following query, how can I define the property "age" as a "short" data-type explicitly?

    MATCH (e:Employee) SET e.age = 55
    
  2. What is the default data type of age as per above query?

Bruno Peres
  • 15,845
  • 5
  • 53
  • 89

2 Answers2

3

Currently, Cypher supports the following basic types: Boolean, Integer, Float, String, List and Map.

When working with Cypher, you do not define the data type. The data type that best fits your value will be chosen for you.

In the indicated query, e.age will be always an Integer. If you change the value for one that don't fits Integer values, then the type will be changed. For example: MATCH (e:Employee) SET e.age = 55.5 will change the data type for Float.

Bruno Peres
  • 15,845
  • 5
  • 53
  • 89
1

This is an old question, I know, and the answer may have been correct at the time given, but I will nevertheless refer to my answer here: https://stackoverflow.com/a/51524709/48779.

It is possible to use cypher functions when importing which means that you can use functions like toInt, date, etc.

Also note that according to https://neo4j.com/docs/cypher-manual/current/syntax/values/ the type landscape of Neo4j has broadened considerably making types like Date, Time, LocalTime, DateTime, LocalDateTime and Duration available.

Unfortunately still no guid/uuid, though ;)