Fork me on GitHub
#datascript
<
2017-03-04
>
qqq21:03:17

Short Question: Is :db/id -1 guaranteed to be INCREASING ? Long Question: I want to sort a list of entities by TIME-WHEN-INSERTED-INTO-DB; do I need to create a separate field, or can I Just hijack :db/id, assuming they were all inserted with -1 ?

petterik21:03:51

You cannot sort entities by the time they were inserted. You can use the datoms api, like (d/datoms :eavt (:db/id entity)) and sort-by :tx to latest the datom of an entity

qqq21:03:46

I need to ponder on this, clearly I'm misunderstanding something.

misha22:03:25

(defn- next-eid [db]
  (inc (:max-eid db)))

qqq22:03:56

is :maz-eid something datascript provides, or am I injecting a new key in it myself?

misha23:03:49

it is internal in ds