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.

Create node based on UNWIND element properties

Hello,
Is it possible to create a node based on the properties of an unwind component without explicitly specifying the properties?

so of X is the unwound item I can perform an ON CREATE SET y.* = x.* ??

Thanks!

3 REPLIES 3

intouch_vivek
Graph Steward

Hi David,
I am not very sure if I understood your requirement
However you can try
with ["1","2"] as list unwind list as a Create(n:AskedNode) return n

Hello,
Here's what I'd like to do.. set all of y to the same properties as item...

UNWIND $items AS item
    WITH item
    MERGE (item: { item.code})-[:HAS_REL]->(y:NEW)
    SET y.* = item.*
    RETURN y

Yes - if I understand your question correctly.

MATCH (o:OtherNode {name: 'unique name'})
WITH o
UNWIND $items as item
CREATE (i:Item)-[:HAS_REL]->(o)
SET i = item
RETURN i, o

you can test it from the browser with by creating the OtherNode:

CREATE (o:OtherNode {name: 'unique name'})

and setting params like so:

:params {items: [{foo: "foo", bar: "bar"}, {baz: 'baz'}]}

Also see Set all properties using a parameter