Fork me on GitHub
#datascript
<
2018-02-26
>
Drew Verlee02:02:35

another question. Hopefully i’ll figure this out shortly.

(ns game.db
  (:require [datascript.core :as d]))

(def schema
  {
   :player/name
   {:db/valueType :db.type/string
    :db/cardinality :db.cardinality/one}})

(def conn (d/create-conn schema))
Throws this error:
1. Caused by clojure.lang.ExceptionInfo
   Bad attribute specification for #:player{:name #:db{:valueType
   :db.type/string}}, expected one of #{:db.type/ref}
   {:error :schema/validation,
    :attribute :player/name,
    :key :db/valueType,
    :value :db.type/string}
which tells me the issue, i just dont get it. why does it expect valueType to have to be a ref? maybe i’m only supposed to specify refs with this setup? I would like to specify the types of everything though in the db…

Drew Verlee02:02:35

i’m trying to follow some combination of the datomic and datascript docs. Notable this example: https://github.com/cognitect-labs/day-of-datomic-cloud/blob/master/tutorial/hello_world.clj

Drew Verlee02:02:48

possible because im not resetting the db…

Drew Verlee02:02:57

https://github.com/tonsky/datascript/wiki/Tips-&amp;-tricks yea. ok so its a bit different then datomic. Thats ok.

devn21:02:01

howdy. im a datomic/datascript newb. Here's what I'd like to do: - I have a collection of maps that changes over time [{:a 1 :b 2} ...]. - Every five minutes I go out and check if there's a new version of this collection. If there is, I would like to incrementally update my datascript store. I don't care about being able to query old versions, I just want my datascript db to be the current view of that collection. Question: - There are a lot of maps in this collection. For my described use case would you recommend I just swap an atom using a background thread containing something like (d/with-db (d/empty-db) (map #(assoc % :db/id (d/tempid 1)) my-coll-of-maps)?

devn22:02:26

Do limits work with pull?