簡體   English   中英

本地開發時如何drop xtdb中的所有數據

[英]How to drop all the data in xtdb during local development

在開發過程中,我發現在我的本地 xtdb 服務器上“遺留”了很多資源。

在不重新啟動我的 repl 的情況下在本地清除此數據的最佳方法是什么?

在提出問題時,我想到了答案:

;; 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)))

只需使用:xt/id鍵搜索所有文檔,因為這是 xtdb 的要求

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM