daniel m
daniel m

Reputation: 415

Create new Node with Relationship to existing Node

I'm new to Neo4J and I'm just playing around with it and get used to it.

I have an existing Node with the label User and a property name thats set to daniel. Now I want to create a new Node Message that has a relationship Send.

MATCH (u:User)
WHERE u.name = 'daniel'
CREATE (m:Message {text = 'hallo welt'} )-[:Send]-(u)

But the Neo4J-Browser just returns "Unknown error". Can someone point out what's wrong with this statement?

Upvotes: 3

Views: 3584

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41676

Colon instead of equals sign in the CREATE. Also there are no undirected rels in Neo4j but you can choose to ignore direction at query time.

MATCH (u:User)
WHERE u.name = 'daniel'
CREATE (m:Message {text : 'hallo welt'} )<-[:SENT]-(u)

see: http://console.neo4j.org/r/4q8r92

Upvotes: 10

Related Questions