During development I find that there's a lot of resources that get "left behind" on my local xtdb server.
What's the best way to clear this data locally without restarting my repl?
During development I find that there's a lot of resources that get "left behind" on my local xtdb server.
What's the best way to clear this data locally without restarting my repl?
While posing the question I thought of the answer:
;; Given some `xtdb-node`
(let [res (xt/q (xt/db xtdb-node)
'{:find [id]
:where [[id :xt/id _]]})
ids (map first res)]
(->> ids
(mapv (fn [id] [::xt/delete id]))
(xt/submit-tx xtdb-node)))
Just search for all documents with the :xt/id
key as that is a requirement of xtdb.