Fork me on GitHub
#datomic
<
2020-11-13
>
marshall16:11:12

@jdkida you can use the pull API directly https://docs.datomic.com/on-prem/pull.html (onprem)

jkida16:11:03

ahh, i see. eid or (unique-id) work?

marshall16:11:14

or lookup ref

marshall16:11:28

it takes an entity identfier

gabor.veres17:11:09

Hi all, newbie question: does Datomic support "ordered" :db/cardinality many attributes? I'd like to store a vector of values, and somehow retrieve the same, ordered vector. The actual use case would be an entity that refers to other entities, but those references do have a defined order. I can't seem to find a way to do this on the data model/schema level. Is this an application/client concern rather, meaning I store data required to reconstruct the order and reorder after retrieval?

val_waeselynck18:11:26

Check out Datofu, it has helpers for that IIRC

Braden Shepherdson17:11:51

well, the underlying indexes are always sorted, but that order doesn't necessarily survive in a query.

Braden Shepherdson17:11:51

generally you have to do your own sorting in memory. if there's some arbitrary order (say, tracks on an album) then you need to record those as attributes.

Braden Shepherdson17:11:32

putting it slightly differently, you might transact {:foo/id (uuid "...") :foo/things [19 12 22]} but that's just a shorthand. it swiftly gets unpacked to a set of entity-attribute-value triples, and the order of your vector is lost. it's just a set to Datomic.

gabor.veres17:11:03

Thanks @braden.shepherdson, that's what I suspected - this is an application level concern then.

favila18:11:46

If you need control over partially-fetching items in a certain order, use d/index-pull

👍 3