Fork me on GitHub

Hi all! I have been using XTDB for a while now and it is amazing. Now I'm trying to use the history capabilities. Basically I want to display the edit history of some documents along with which user made the edit (users are entities in the db) and the option to view the document at a time in the history. Is it possible to fetch the history of a document in XTDB, and perhaps to attach some metadata to transactions (to track who made the edit)? Any pointer are welcome, thanks!


Hi Jesse. Thanks for your kind words. Yes, the API function is entity-history. See


You can add transaction metadata by creating a separate document describing who made the edit and linking it from the document you're putting.


If you're putting multiple docs in the same tx, one thing you can do is use a transaction function to add a 'metadata' document. The tx-id is available when you're in a transaction function, so you can add it as an attribute to your metadata document. That way, you can query a metadata document back, given a transaction id.


Clear, that will work fine 👌 Falling in love with XTDB. Just having a hard time finding the right info sometimes, thanks for the help!


Let us know if you need any further help.

Dustin Getz11:09:10

can xtdb branch like git?


Hey @U09K620SG, as Malcolm said - no, not currently. What kind of use-cases most interest you? Testing? Multi-master replication?


There is the with-tx API, which could simulate what you're showing here, I think

Dustin Getz21:09:52

Conor at Roam Research was interested in a multiplayer SVG editor with undo/redo where the history was tracked in a database - that was the origin of my question

Dustin Getz21:09:08

Other than that yeah, experimental UI stuff


Oh cool, SVG is great. I'm a big Inkscape fan too. I've been playing with a fair bit lately to generate SVGs dynamically


No. Although that would be cool. 🙂