This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-10
Channels
- # announcements (16)
- # asami (7)
- # aws (5)
- # beginners (46)
- # calva (47)
- # clj-kondo (3)
- # cljdoc (23)
- # clojure (70)
- # clojure-germany (1)
- # clojurescript (6)
- # community-development (2)
- # datomic (3)
- # emacs (14)
- # exercism (5)
- # hyperfiddle (4)
- # jobs (1)
- # kaocha (9)
- # lsp (13)
- # malli (6)
- # membrane (11)
- # off-topic (22)
- # pedestal (4)
- # portal (19)
- # quil (3)
- # reagent (8)
- # remote-jobs (1)
- # shadow-cljs (48)
- # spacemacs (5)
This does not work:
(d/transact conn {:tx-data [{:id [:person/id "person2"]}
[:db/add [:id [:person/id "person2"]] :person/full-name "Bob"]]})
(It will create one entity with :id
and :a/node-<num>
b/ident and another one with db/ident [:id [:person/id "person2"]]
.)
I guess it is due to what https://clojurians.slack.com/archives/C018H97E02D/p1648752474852009?thread_ts=1648748922.963539&cid=C018H97E02D
> You're creating an entity [...] you try to reference it with: [:id ...]
That tells the transactor to look up a node that has that as an id. But... there IS no node that has that as an ID. You're still creating it, so it doesn't exist yet. It won't exist until the end of the transaction
I.e. I cannot combine entities and triplets and I must insert all the data as single entity map. Is that correct? And should this ☝️ be eventually supported?
Thank you!!!I don't actually follow what’s going on with the :db/add. That's wrong. Also, I don't know if a compound key can work for re-use during a transaction. I need to check on that
🙏 1
You mean what Asami does is wrong or what I do is wrong 😅?
Hmmm, I thought it was wrong, but maybe not. I think node lookups can only happen when they're in the database to be looked up
OK... I'm looking at the code, and :db/add
does not support node-refs at all. But it won't be hard to add them. I'm working on it now, but I have to leave for the afternoon/evening as I'm taking my daughter somewhere. Hopefully I can get it finished soon
You are wonderful, thank you!