clojure - Find oldest entity with a certain attribute that may have been retracted in Datomic? -


i'd find oldest entity has attribute called :app/type. oldest entity might (or might not) have been retracted. how can construct query find this?

you can use d/history function obtain database in can query additions , retractions across time.

i'm not entirely sure want achieve, query returns entity oldest transaction involving :app/type, transaction id, , whether entity added or retracted.

(d/q '[:find ?e (min ?tx) ?added        :where        [?e :app/type ?v ?tx ?added]]      (d/history db)) 

Comments