I have a field in my schema defined as {:db/valueType :db.type/ref :db/cardinality :db.cardinality/many}
and I'm trying to construct a transaction that updates that field with unique refs
ugh, can't paste my example without slack trying to munge colons into emoji
I've tried
[:db/add eid :thing/tagged [:tag/name ["foo" "bar"]]]
and [:db/add eid :thing/tagged [[:tag/name "foo"] [:tag/name "bar"]]]
and neither seem to work
ah, i see
(let [schema {:thing {:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many}
:other {:db/unique :db.unique/value}}
conn (d/create-conn schema)]
(d/transact! conn [{:other "thing-1"}
{:other "thing-2"}])
(let [{:keys [tempids]} (d/transact! conn [{:main "thing"
:db/id "temp"}])]
(d/transact! conn [[:db/add (get tempids "temp") :thing [:other "thing-1"]]
[:db/add (get tempids "temp") :thing [:other "thing-2"]]])
(d/pull (d/db conn) [:main
{:thing [:other]}] (get tempids "temp"))))
;; => {:main "thing", :thing [{:other "thing-1"} {:other "thing-2"}]}
aah
thanks
👍
sorry to overuse thing
so much lol
eh it gets the idea across
I'm beginning to think this may be more trouble than it's worth for me