Background: In Datomic,
cardinality/many relationships are sets. Therefore any inherent ordering in the original collection is by default lost upon storage. To preserve sequential information, one must manually implement a linked list or a position attribute, or serialize the list and store that.
Question: Fellow Datomic users: how are you finding each of these options? Are there some that feel particularly elegant or clunky in your use case? Have you perhaps switched from one approach to another, or do you plan to? I’ve been tracking position in other attributes and I feel rather ambivalent about the need to manually maintain that attribute.
(Aside: First-class ordered lists are a feature request from 2012, per Stuart Halloway:
The top-level decision with lists is “Do you want to query inside them?” If the answer is yes, then you should model a linked list or a positional list in Datomic. If you do not need to query inside lists, then you should request that we add support for lists as a first-class type. (We are already considering this.)
I’ve upvoted the “Ordered multivalues” feature request in my.datomic.com and agree that first-class support would be stellar.)