Fork me on GitHub
#xtdb
<
2021-04-20
>
bartuka10:04:45

do we have any GUI client for crux?

3
refset11:04:20

Hey, there's actually an SPA embedded on the routes for crux-http-server so you can curl for the raw data or open the same url in a browser to see some visuals 🙂 it's still work-in-progress but I'd be interested to hear if you find it useful already

bartuka11:04:24

thanks @taylor.jeremydavid, I got curious because wanted to show my entities to other people that does not know crux yet but knows mongodb

bartuka11:04:37

I was under the impression that something like mongo compass db might exist for crux

refset12:04:21

Ah okay, well we definitely have some more work to do before it's as useful as Compass! It's good to hear that there's interest in such a thing though, thanks

dvingo15:04:47

I'm definitely interested in such a tool - obviously you can use a repl, but it is nice to have the UI option. I tried the http-server recently and saw there are some exceptions with certain queries - are contributions welcome for addressing some of these things or adding features? or is this too unstable and likely to change to be worth investing the time in?

Steven Deobald15:04:16

@U051V5LLP What sort of exceptions were you seeing? If you mean capital-E Exception, there is infinite appetite for bug fixes. 😉 If there are exceptional cases you'd like to build features for, I'm willing to bet there's appetite for that too but it's probably worth opening a GitHub issue to build against and/or pinging @taylor.jeremydavid and/or @U050V1N74 to check if your patch will run up against any obvious problems.

☝️ 6
dvingo15:04:10

Thanks Steven - yep they were js Exceptions. Good to know bug fixes are welcome 🙂 I don't have my dev env setup right now but I'll keep it in mind to open some GitHub issues for those and for any features that cross my mind

👍 6
refset15:04:47

even casually throwing a screenshot up on here (with the js console visibly open) would be great 🙏

dvingo15:04:41

good to know! will keep it in mind

bartuka16:04:21

@taylor.jeremydavid are we able to contribute with documentation?

refset19:04:01

yes, certainly - if you have small suggestions about wording or an example to add you can just message me and I'll happily do the work to amend the docs accordingly. However if you are keen to create a PR and want to work on the docs locally then you should be able to follow the instructions here: https://github.com/juxt/crux/tree/master/docs

🚀 3
bartuka16:04:49

it was not clear to me the role of :crux.db/id inside joins. From this example below, I should keep my domain entity id and crux.db/id to be the same values. is this correct conclusion? (when they are different, the join does not work)

;;; example 1 - crux.db/id different from my entity id
(def e1 {:crux.db/id "112" :wand/id "111" :wand/valor 42 })
(def e2 {:crux.db/id "223" :veri/id "222" :veri/wand.id "111" :veri/valor 24})

(crux/submit-tx crux-node [[:crux.tx/put e1]])
(crux/submit-tx crux-node [[:crux.tx/put e1]])

(crux/q (crux/db crux-node)
        '{:find [(pull e [:veri/valor {:veri/wand.id [:wand/valor]}])]
          :where [[e :veri/id "222"]]})
;; => #{[#:veri{:valor 24, :wand.id {}}]}


;;; example 2 - crux.db/id the same as my entity id
(def ee1 {:crux.db/id "333" :wand/id "333" :wand/valor 42})
(def ee2 {:crux.db/id "444" :veri/id "444" :veri/wand.id "333" :veri/valor 24})

(crux/submit-tx crux-node [[:crux.tx/put ee1]])
(crux/submit-tx crux-node [[:crux.tx/put ee2]])

(crux/q (crux/db crux-node)
        '{:find [(pull e [:veri/valor {:veri/wand.id [:wand/valor]}])]
          :where [[e :veri/id "444"]]})
;; => #{[#:veri{:valor 24, :wand.id #:wand{:valor 42}}]}

nivekuil17:04:43

that's how it has to work, because crux doesn't know anything about your data model, so it doesn't know which keys can be joined. I personally use pathom for this, serving among other things as a schema for pull queries

✔️ 3
bartuka18:04:51

it makes sense, thanks @U797MAJ8M

👍 3
🙏 3