I'd like to get the history of values for a particular field in Datomic.
My intuition is to use (d/history) like
(d/q '[:find ?entity ?field-val ?date ?tx
:in $
:where
[?entity :namespace/field ?field-val ?tx]
[?tx :db/txInstant ?date]]
(d/history (db/get-db)))
However, this query will duplicate most values because it lists every retraction as well as every value update (every db/add and db/retract).
I thought maybe I could query the datoms with the transaction, then check the operations. But I can't find a way to query the datoms.
(d/pull db '[*] tx-id)doesn't include datoms.- search engine results were not helpful for keywords like "query datomic transaction datoms"
- searching for datomic transaction schema is not fruitful
I can use tx-range, but that seems unweildly.
Any better approaches?