This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (9)
- # babashka (19)
- # beginners (39)
- # calva (7)
- # cherry (1)
- # cider (2)
- # clojure (31)
- # clojure-europe (8)
- # clojure-norway (9)
- # datalevin (10)
- # events (2)
- # fulcro (10)
- # hyperfiddle (9)
- # joker (1)
- # lsp (50)
- # membrane (34)
- # minecraft (2)
- # missionary (21)
- # off-topic (17)
- # pedestal (1)
- # polylith (8)
- # reitit (3)
- # sql (4)
- # squint (16)
- # xtdb (14)
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 https://docs.xtdb.com/clients/clojure/#_entity_history
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!
Hey @U09K620SG, as Malcolm said - no, not currently. What kind of use-cases most interest you? Testing? Multi-master replication?
Ah, just saw your other post https://clojurians.slack.com/archives/C7Q9GSHFV/p1662839055795149
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
Oh cool, SVG is great. I'm a big Inkscape fan too. I've been playing with https://github.com/babashka/scittle a fair bit lately to generate SVGs dynamically