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 do I reference a node in relationship property

Dear All:
I want to implement something like the following:
create (London:City {name:"London"})
create (n:Person {name:"Nana"}) - [r:meet {date:"2021-02-05", city: London}] -> (m:Person {name:"John"}) , but this doesn't work.
it show error "Property values can only be of primitive types or arrays thereof".
I can only use city:"London" .But my intention is to refer directly to node: London instead of string "London".
I think maybe I'll have to build another event Node, like:
create (event:Event {name: "meetEvent",date:"2021-02-05"})
create (n: Person {name:"Nana"}) - [r: hasEvent] -> (event)
create (event) - [r: takePlaceIn] -> (London)
Is there a better way to do it?
Thanks a lot !

3 REPLIES 3

I think maybe Neo4j doesn't support variable or node types relationship property, I don't know if this is the case, then my idea may not be realized

That is correct, you cannot directly reference a node as a node or relationship property.

An :Event node makes sense.

I see. Thank you, Andrew