datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
marshall 2020-11-13T16:31:12.402400Z

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

marshall 2020-11-13T16:31:30.402600Z

https://docs.datomic.com/cloud/tutorial/read.html#pull (cloud)

jkida 2020-11-13T16:33:03.403700Z

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

marshall 2020-11-13T16:33:14.403900Z

or lookup ref

marshall 2020-11-13T16:33:28.404300Z

it takes an entity identfier

gabor.veres 2020-11-13T17:18:09.408300Z

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_waeselynck 2020-11-15T18:56:26.414300Z

Check out Datofu, it has helpers for that IIRC

2020-11-13T17:26:51.409Z

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

2020-11-13T17:27:51.409800Z

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.

2020-11-13T17:30:32.412400Z

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.veres 2020-11-13T17:39:03.413700Z

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

favila 2020-11-13T18:14:46.413800Z

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

👍 1