Hi, when with
is executed for a DB that is gotten from the original DB by calling as-of
function then the execution of with
returns a map where the database available by key :db-after
still points to the original DB. I mean when I use after db
to get an updated entity I still see old data
The script to reproduce the issue:
(require '[datomic.api :as d])
(d/create-database "datomic:dev://localhost:4334/test?password=datomic")
(def conn (d/connect "datomic:dev://localhost:4334/test?password=datomic"))
(def user-schema [
{
:db/ident :User/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity
}
{
:db/ident :User/value
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
}
])
(d/transact conn user-schema)
(def user-name "User_name")
(def user-value "User_value")
(def user-data [
{
:db/id user-name
:User/name user-name
:User/value user-value
}
])
(d/transact conn user-data)
(def user-updated-value "User_value_updated")
(def user-updated-data [
{
:User/name user-name
:User/value user-updated-value
}
])
(def db (d/db conn))
(def asOfDbByBasisT (d/as-of db (d/basis-t db)))
(def txResult (d/with asOfDbByBasisT user-updated-data))
(def snapshotDbAfter (get txResult :db-after))
(def entity (d/entity snapshotDbAfter [:User/name user-name]))
(get entity :User/value)
“User_value” is returned instead of expected “User_value_updated”
Datomic Pro 1.0.6397