Fork me on GitHub
#datomic
<
2019-10-04
>
souenzzo20:10:28

(let [schema [{:db/ident       :foo/checked?
               :db/valueType   :db.type/boolean
               :db/cardinality :db.cardinality/one}
              {:db/ident       :foo/id
               :db/valueType   :db.type/string
               :db/unique      :db.unique/identity
               :db/cardinality :db.cardinality/one}]
      {:keys [db-after]} (d/with (d/with-db @user/conn) {:tx-data schema})
      {:keys [db-after]} (d/with db-after {:tx-data [{:foo/id       "ok"
                                                      :foo/checked? true}
                                                     {:foo/id "not-ok"}]})]
  {:ok        (d/pull db-after {:eid      [:foo/id "ok"]
                                :selector '[:db/id
                                            (:foo/checked? :default false)]})
   :not-ok    (d/pull db-after {:eid      [:foo/id "not-ok"]
                                :selector '[:db/id
                                            (:foo/checked? :default false)]})
   :not-ok-42 (d/pull db-after {:eid      [:foo/id "not-ok"]
                                :selector '[:db/id
                                            (:foo/checked? :default 42)]})})
=>
{:ok {:db/id 60332402039328370, :foo/checked? true},
 :not-ok {:db/id 65148262968987251, :foo/id "not-ok"},
 :not-ok-42 {:db/id 65148262968987251, :foo/checked? 42}}
There is a bug in datomic/pull default-option https://docs.datomic.com/cloud/query/query-pull.html#default-option Should I open a "formal" ticket in or this report is enough?

ghadi20:10:02

what was the expectation with :not-ok-42 @souenzzo?

souenzzo20:10:40

It's just to confirm that the issue is with false value: once it work with the value 42, everything else inside the test scenario is ok. @ghadi

ghadi20:10:46

i think i understand

souenzzo20:10:08

For me it clarifies that the issue is related to :default false and *not* related to :default with boolean atribute or even you are using a old version of datomic that not support default

ghadi20:10:55

it's actually a correct test case

ghadi20:10:00

but illustrative

jaret21:10:14

@souenzzo @ghadi that looks like a bug to me. I’ve made a case in support and I’ll track it down this weekend.

👍 4
johnj22:10:35

Is it normal for the client to take longer to start up than the peer for a very small DB ?