cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to 'duplicate' a node

Running community edition 4.3.2 on Ubuntu 20.04

Hi all,

I have the following question:

How can I duplicate a node, in a new node with another name, but maintaining all the properties?
Or, in orhet word, how can I duplicate the name changing the name of the node?

Example:

MATCH (p:Person)

CREATE (n:Node)
    SET n = {p}
1 ACCEPTED SOLUTION

This seems to work. It creates the new node will all the properties of the existing node, then overwrites a property (or more if you want, or add new ones).

match(n:Test{id:100})
with n
create (m:Test)
set m = n
set m.name = 'new name'
return m

View solution in original post

1 REPLY 1

This seems to work. It creates the new node will all the properties of the existing node, then overwrites a property (or more if you want, or add new ones).

match(n:Test{id:100})
with n
create (m:Test)
set m = n
set m.name = 'new name'
return m