neo4j] Change property type of node in Neo4j (노드 속성 자료형 바꾸기)

neo4j] Change property type of node in Neo4j (노드 속성 자료형 바꾸기)

이번 글에서는 아래의 내용을 정리하려고 합니다.

노드의 propery 자료형 바꾸기

노드의 속성 자료형을 바꾸는 방법은 생각보다 (?) 간단했다.

Python 등과 비슷한 'toInteger' 함수를 이용하면 된다.

바꾸고자 하는 노드를 MATCH 한 후, SET 문으로 설정하기 !

example

Person의 'age' property가 String으로 설정되어있어 Int 형으로 바꾸고 싶을 때는 아래와 같이 cypher 문을 작성하면 된다.

MATCH (c:Person) SET c.age = toInteger(c.age);

다른 자료형 변환 함수도 있을 것 같은데, 다 조사하지는 못하였다.

위의 예시를 활용해서 사용하면 될 것 같다.

toString()

integer, float, boolean, string, point, duration, date, time, localtime, localdatetime or datetime value to a string.

integer, float, boolean, string, point, duration, date, time, localtime, localdatetime or datetime value to a string. toBoolean()

string, integer or boolean value to a boolean value.

string, integer or boolean value to a boolean value. toFloat()

integer, floating point or a string value to a floating point number.

from http://song-study.tistory.com/9 by ccl(A) rewrite - 2021-12-01 16:26:45