Hi β working on my first project with Neo4j and am looking for opinions about the best way to model something.
So the idea is there are (c:Collection) nodes and (d:Document) nodes. The (c:Collection) nodes can -[r:CONTAINS]-> a (d:Document).
The order of the documents contained by the collection is very important, and the order of the documents needs to be easy to change so I need to figure out the best way to store order values.
Option 1: It seems like the most natural way is to store the order is as a property of the relationship e.g. (c:Collection) -[r:CONTAINS {position: $position}]-> (d:Document), but Iβm totally unclear on the best way to reorder the documents without having to make a database query to edit each relationship every time the order is changed.
Option 2: Alternatively, I could just store the order in an array as a property of the parent collection, which I could then revise with one query, but that feels non-idiomatic and clumsy.
Is there a way to take a map of key/values (id: position) as a param and use that to set the position property of each -[:CONTAINS]-> relationship for a collection without having to make a bunch of queries? Or another way to make option 1 work smoothly?
Or should I just use #2, or some other approach?
Thanks for any thoughts!