Fork me on GitHub
Jakub Holý (HolyJak)17:04:44

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;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
Jakub Holý (HolyJak)17:04:51

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


I could create a map during the transaction to try to cache this


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

Jakub Holý (HolyJak)19:04:49

You are wonderful, thank you!