This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-27
Channels
- # announcements (2)
- # babashka (24)
- # beginners (116)
- # cider (7)
- # cljsrn (6)
- # clojure (38)
- # clojure-bay-area (4)
- # clojure-europe (3)
- # clojure-losangeles (1)
- # clojure-norway (10)
- # clojurescript (171)
- # datomic (16)
- # honeysql (3)
- # improve-getting-started (1)
- # introduce-yourself (2)
- # java (12)
- # malli (5)
- # membrane (2)
- # pedestal (3)
- # shadow-cljs (79)
- # spacemacs (6)
- # xtdb (10)
EDIT, needed to use :in
to perform the matching. Disregard. Thanks team 🙂
(defn new-download [version filename]
(xt/submit-tx xtdb-node [[::xt/put
{:xt/id version
:driver/version version
:driver/filename filename}]]))
(defn download-version [version]
(xt/q (xt/db xtdb-node) '{:find [e]
:where [[e :driver/version version]]}))
I have a noob question, I'm following the tutorial and my find query is seemingly returning everything rather than the one document with the exact match to my query...
obs.db> (new-download "1.2.3" "filename")
;; => #:xtdb.api{:tx-id 1, :tx-time #inst "2023-12-27T12:07:19.554-00:00"}
obs.db> (download-version "1.2.3")
;; => #{["1.2.3"]}
obs.db> (new-download "4.5.6" "filename")
;; => #:xtdb.api{:tx-id 2, :tx-time #inst "2023-12-27T12:07:44.605-00:00"}
obs.db> (download-version "1.2.3")
;; => #{["1.2.3"] ["4.5.6"]}
obs.db>
I know I'm more than likely doing something wrong, but can someone point me in the right direction?Nevermind, I had to utilize the :in
clause, I thought I could enclose the query with the value that I needed but I think because it's implemented with macros that's not possible
Hey, thanks for following up with your own answer here 🙂 to clarify you can do all kinds of things to work around the quoting (`assoc`, the backtick library etc.) but :in
is usually the right choice, yep 👍
How should I think about structuring data with XTDB? I come from a traditional databases background. Would the idea be that related data should be grouped via the qualified keywords?
For example, would a document representing a user likely contain mostly keywords like this: :user/username
, etc.?
but if you want to do things like search by :name
from any entity type, then you could have the same name attribute
Watching https://www.juxt.pro/blog/bitemporality-and-the-art-of-maintaining-accurate-databases/ today
It’s a great presentation, my use case is about times that get delayed and thinking about bitemporality on a graph database of departure and arrival times is bending my brain a little bit