Fork me on GitHub
#datascript
<
2019-09-28
>
Quest19:09:43

Anyone know why query for 2-element tuple fails, but hardwiring the value in works?

(db/q '[:find ?e
        :in [$ ?idc]
        :where
        [?e :nsm.entity/idc ?idc]]
        (db/db a)
        [#uuid "bac0858c-46a6-4ae1-8f18-060f197b95e9"
        #uuid "00000000-0000-0000-0000-000000000000"])
> Error: Cannot parse binding, expected (bind-scalar | bind-tuple | bind-coll | bind-rel)
    at new cljs$core$ExceptionInfo
    at Function.cljs$core$IFn$_invoke$arity$3
    at Function.cljs$core$IFn$_invoke$arity$2
    at datascript$parser$parse_binding
    at datascript$parser$parse_tuple_el
contrast with working
(db/q '[:find ?e
        :where
        [?e :nsm.entity/idc [#uuid "bac0858c-46a6-4ae1-8f18-060f197b95e9"
        #uuid "00000000-0000-0000-0000-000000000000"]]]
        (db/db a))
> #{[1]}
schema of :nsm.entity/idc is unique tuple of UUIDs
{:db/ident :nsm.entity/idc
 :db/valueType :db.type/tuple
 :db/tupleTypes [:db.type/uuid :db.type/uuid]
 :db/cardinality :db.cardinality/one
 :db/unique :db.unique/identity}