datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
Jake Shelby 2020-08-12T00:31:38.174100Z

interesting … one thing I can think of that would still be limited is the index - are you still able to look up that entity using the value of that large string in a query?

Josh 2020-08-12T01:17:48.174300Z

It seems so, this query returns the expected id

(d/q '[:find ?e
       :in $ ?s
       :where
       [?e :string ?s]]
       (get-db)
       s)

souenzzo 2020-08-12T13:15:28.176200Z

Datomic Team There is a issue/tracker for this issue?

(let [db-uri (doto (str "datomic:mem://" (d/squuid))
               d/create-database)
      conn (d/connect db-uri)
      db (d/db conn)]
  (first (d/index-pull db
                       {:index    :avet
                        :start    [:db/txInstant]
                        :reverse  true
                        :selector '[(:db/id :as :not-id :xform clojure.edn/read-string)]})))
selector :as do not work on :db/id, in any context (pull, query-pull, index-pull)... PS: :db/id do not respect ANY param. xform also not work with it.

Sam DeSota 2020-08-12T20:36:51.177900Z

I'm trying to transact a :db/fn via a custom client that works from javascript, but I'm struggling to get the schema right. I keep getting an error:

Value {:lang :clojure, :params [db eids pull-expr], :code "(map eids (fn [eid] (datomic.api/pull db pattern eid)))", :imports [], :requires []} is not a valid :datomic/fn for attribute :db/fn

Sam DeSota 2020-08-12T20:37:10.178400Z

It's not clear what's missing to correctly transact this function, using the on-prem obviously. Any ideas?

favila 2020-08-12T20:41:55.179600Z

You should show your code, but it sounds like you are transactions a map instead of a d/function object

favila 2020-08-12T20:42:33.180600Z

You can make one either with d/function or the #db/fn reader literal

Sam DeSota 2020-08-12T20:44:40.180800Z

Yes, I’m transacting a map, I assumed that’s how transit serialized the d/function object. The issue is that I’m doing this from a javascript library that doesn’t have access to d/function, on the transit level how is this object serialized? (using this from javascript is obviously non-standard, but necessary for my org)

favila 2020-08-12T20:50:01.181500Z

I missed that you were using a custom client

favila 2020-08-12T20:50:27.182400Z

You control all of this, so whatever you are doing is what you are doing :)

favila 2020-08-12T20:50:53.183100Z

But when you call d/transact, you need a function object

favila 2020-08-12T20:51:54.184Z

It’s unclear to me how you made a d/function object from JavaScript?

Sam DeSota 2020-08-12T23:55:39.184200Z

I ended up just shifting to putting the txfns in the datomic install classpath