When transacting how do you go about referencing an entity that doesn’t yet have an id? I thought the docs implied if you used the :db/id
key it would use the supplied value as a temp id:
I thought it was something like this:
[{:db/id -1
:person/name "sally"}
{:person/name "joe"
:person/spouse -1}
]
I’m very confused, the code here doesn’t work:
(def schema {:car/maker {:db/type :db.type/ref}
:car/colors {:db/cardinality :db.cardinality/many}}
(def conn (d/create-conn schema))
(d/transact! conn [{:db/id -1
:maker/name "BMW"
:maker/country "Germany"}
{:car/maker -1
:car/name "i525"
:car/colors ["red" "green" "blue"]}])
(d/q '[:find ?name
:where
[?e :maker/name "BMW"]
[?c :car/maker ?e]
[?c :car/name ?name]]
@conn)
From this blog post: http://udayv.com/clojurescript/clojure/2016/04/28/datascript101-chapter1-initializing-inserting-and-querying-records/i guess its supposed to be valueType
not type
i’m learning the goto place is tests not blogs 🙂
@carocad I’ve used datascript with way more than 100k datoms
We used it with an order of magnitude or more datoms in production
Is there a limit to how far down a graph you can walk with the pull api?
e.g to get the great grandson of person/entity 1.
(d/pull db [{:son {:son {:son [:db/id]}}} 1])
I know you can easily walk one relationship.