replikativ/datahike

[Bug]: Property cardinality/many' gets ignored in as-of-databases

Closed this issue · 0 comments

What version of Datahike are you using?

0.5.1512

What version of Java are you using?

openjdk 11.0.13 2021-10-19

What operating system are you using?

Ubuntu

What database EDN configuration are you using?

{:store              {:backend :mem}
 :keep-history?      true
 :schema-flexibility :write 
 :attribute-refs?    true}

Describe the bug

Querying a as-of-database with attribute references returns only a single option for attributes with :db.cardinality/many

What is the expected behaviour?

Should return all options.

How can the behaviour be reproduced?

(let [schema [{:db/ident       :name
                     :db/cardinality :db.cardinality/one
                     :db/unique      :db.unique/identity
                     :db/valueType   :db.type/string}
                      {:db/ident       :aka
                       :db/cardinality :db.cardinality/many
                       :db/valueType   :db.type/string}]
              conn (setup-db (assoc keyword-cfg :attribute-refs? true))
              _ (d/transact conn schema)
              {tx-data                 :tx-data
               {:keys [db/current-tx]} :tempids} (d/transact conn [{:name "Michal" :aka ["Tupen" "Devil"]}])
              michal (:e (first (filter #(= "Michal" (:v %)) tx-data)))
              as-of-db (d/as-of @conn current-tx)]
           (d/pull as-of-db [:aka] michal) ;; returns ["Devil"], should be ["Tupen" "Devil"]
))