Fork me on GitHub
#xtdb
<
2022-03-19
>
Hukka07:03:33

I was checking how to do some auditing based on the transaction time, using the space adventure as a basis. At first I tried changing the entity-history params so that it would show an older version of the contents:

(xt/entity-history
   (xt/db node {::xt/valid-time #inst "2200-01-01"})
   :kaarlang/clients
   :desc
   {:with-docs true
    :end-tx-time #inst "2022-01-01"})
but neither the end-tx-time nor the end-tx-id seem to do anything. Then I checked the https://docs.xtdb.com/concepts/bitemporality/#crime, but using `
(xt/db node {::xt/tx #inst "2019-01-03"})
also just gave the full history. Then I found out from https://docs.xtdb.com/clients/clojure/#_db that the right key is actually ::xt/tx-time. So I got it working, but I have no idea if the entity-history is supposed to filter transactions, and there seems to be a bug in the crime scene docs?

refset12:03:48

Hey @U8ZQ1J1RR thanks for mentioning this! > I have no idea if the entity-history is supposed to filter transactions Yep, it definitely should be filtering correctly - the indexes are very much designed to allow you to scan partial sections of history. I'll try to get the docs fixed soon (before the next release is cut!) 🙏