Fork me on GitHub
#datascript
<
2018-03-05
>
Drew Verlee00:03:01

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}
]

Drew Verlee01:03:13

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/

Drew Verlee02:03:31

i guess its supposed to be valueType not type

Drew Verlee02:03:58

i’m learning the goto place is tests not blogs 🙂

devn03:03:14

@carocad I’ve used datascript with way more than 100k datoms

devn03:03:01

We used it with an order of magnitude or more datoms in production

Drew Verlee17:03:01

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])

Drew Verlee17:03:14

I know you can easily walk one relationship.