mardi 9 juillet 2019

Neo4j/Cypher - Get random node from matched result

I need to seed a Neo4j database. Let's say after adding Person nodes, I need them to write Books. Here's what I have so far:

MATCH (p:Person)
WITH ["Book 1", "Book 2", "Book 3", "Book 4", "Book 5"] AS titles
UNWIND titles AS title
CREATE (???)-[:CREATED]->(:Content { title: title, content: "Words..." })

I was thinking I could fill in the ??? with a random person from p, which was MATCHed on the first line. How can I do this?




Aucun commentaire:

Enregistrer un commentaire