Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-08-2020 05:27 AM
Hello
I have the following nodes:
I want to:
MERGE (c:Collection{name:"Holiday meals"})
WITH c
MATCH (u:User{email:"test@gmai.com"})
MERGE (u)-[rel:COLLECTION_CREATED{createdOn:datetime()}]->(c)
RETURN c
Unfortunately there is no uniqueness because of createdOn property in the relationship and every time there is a new relation created between the nodes.
What can I do to fix this?
Any suggestions about changes in architecture or current implementations will be welcomed
Thanks
Solved! Go to Solution.
05-08-2020 05:55 AM
You need to move setting the onCreated
property into a ON CREATE
handler:
WITH c
MATCH (u:User{email:"[test@gmai.com](mailto:test@gmai.com)"})
MERGE (u)-[rel:COLLECTION_CREATED]->(c)
ON CREATE SET rel.createdOn = datetime()
RETURN c```
05-08-2020 05:55 AM
You need to move setting the onCreated
property into a ON CREATE
handler:
WITH c
MATCH (u:User{email:"[test@gmai.com](mailto:test@gmai.com)"})
MERGE (u)-[rel:COLLECTION_CREATED]->(c)
ON CREATE SET rel.createdOn = datetime()
RETURN c```
All the sessions of the conference are now available online