This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-05
Channels
- # bangalore-clj (4)
- # beginners (16)
- # boot (4)
- # cljs-dev (1)
- # cljsrn (2)
- # clojure (177)
- # clojure-italy (2)
- # clojure-nl (1)
- # clojure-russia (41)
- # clojure-spec (3)
- # clojure-uk (21)
- # clojurescript (46)
- # code-art (1)
- # datomic (10)
- # hoplon (125)
- # leiningen (1)
- # luminus (2)
- # lumo (1)
- # off-topic (10)
- # onyx (69)
- # re-frame (22)
- # reagent (4)
- # ring (32)
- # rum (6)
- # specter (2)
- # untangled (5)
If I submit a transaction, and then immediately thereafter get the entity id for the entity that I created using d/resolve-tempid
; and if I then (in the repl) attempt to pull that entity use d/pull
, the value that i get back includes only the :db/id
, like so:
{:db/id 17592186045517}
And not the whole set of nested datoms. If i then close out the repl, restart the repl, and reinitiate the db, and then do the pull, then I get the whole thing:
{:db/id 17592186045517,
:arb/value
[{:db/id 17592186045519,
:arb/value [{:db/id 17592186045521, :content/text "Title"}],
:arb/metadata [{:db/id 17592186045520, :metadata/html-tag :h1}]}
{:db/id 17592186045522,
:arb/value [{:db/id 17592186045524, :content/text "Paragraph"}],
:arb/metadata [{:db/id 17592186045523, :metadata/html-tag :p}]}],
:arb/metadata [{:db/id 17592186045518, :metadata/html-tag :div}]}
Can someone clue me into why that might be?@ezmiller77 Are you using db-after
for the db?
@rauh I believe so. I get the entity id after the transaction with this fn:
(defn transact-and-get-id
"Transact tx and return entity id."
[conn tx]
(let [tempid (:db/id tx)
post-tx @(d/transact conn [tx])
db (:db-after post-tx)
entid (d/resolve-tempid db (:tempids post-tx) tempid)]
entid))
That must be it. I’ve saved db
before the transaction!
Thanks much. Still very much getting used to thinking datomically.