Fork me on GitHub
#datascript
<
2020-08-01
>
lilactown01:08:02

ok, another dumb question

lilactown01:08:15

how do I transact something with a lookup ref?

lilactown01:08:19

given this schema:

(def ^:private schema
  {::node-id {:db/unique :db.unique/identity}})
doing this:
(ds/db-with (ds/empty-db schema)
            [{::node-id "root"}
             {::node-id "seg-asdf"
              ::node-type ::segment/v3
              ::parent [::node-id "root"]}])
just seems to store [::node-id "root"] literally in the ::parent attribute of the 2nd entity, rather than storing an entity-id

lilactown04:08:13

ah ok, I needed to add {:db/valueType :db.type/ref} to the schema for ::parent

🎉 3