Property value to a label

The available procedure is described in the table below:

CALL apoc.create.addLabels( [node,id,ids,nodes], ['Label',…​])

adds the given labels to the node or nodes

Example Usage

The example below will help us learn how to use this procedure.

The following creates a Movie node with title and genre properties
CREATE (:Movie {title: 'A Few Good Men', genre: 'Drama'})
The following moves the 'genre' property to a label and removes it as a property
MATCH (n:Movie)
CALL apoc.create.addLabels( id(n), [ n.genre ] )
YIELD node
REMOVE node.genre
RETURN node