Lookup refs using an input
Open
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 5.8k
- Forks
- 318
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I'm trying to do a query using lookup refs, using an input variable in the lookup ref, like this:
(d/q '[:find ?e
:in $ ?client-squuid
:where [?e :appointment/client [:thing/squuid ?client-squuid]]]
(d/db conn)
#uuid "5664cb92-8256-49f9-a7ff-30d3d00939c4")
When I do the above, I get:
#object[Error Error: Cannot compare 5664cb78-8010-4d4e-bfdf-b1b6416396d2 to ?client-squuid]
cljs.core.UUID.cljs$core$IComparable$_compare$arity$2 (jar:file:/Users/alistair/.m2/repository/com/cognitect/transit-cljs/0.8.225/transit-cljs-0.8.225.jar!/cognitect/transit.cljs:42:14)
cljs.core/-compare (jar:file:/Users/alistair/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170.jar!/cljs/core.cljs:701:22)
cljs.core/compare (jar:file:/Users/alistair/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170.jar!/cljs/core.cljs:2080:5)
datascript.db/cmp-val (jar:file:/Users/alistair/.m2/repository/datascript/datascript/0.13.3/datascript-0.13.3.jar!/datascript/db.cljc:285:6)
datascript$db$cmp_datoms_avet (jar:file:/Users/alistair/.m2/repository/datascript/datascript/0.13.3/datascript-0.13.3.jar!/datascript/db.cljc:308:6)
even though this:
(d/q '[:find ?e
:where [?e :appointment/client [:thing/squuid #uuid "5664cb92-8256-49f9-a7ff-30d3d00939c4"]]]
(d/db conn))
works fine.
Is this expected behaviour?
Cheers!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two d/q forms with the shown UUID input, then inspect datascript/db.cljc at cmp-val and cmp_datoms_avet named in the stack trace. Done means determining whether lookup refs with an input are supported and correcting the behavior or documenting the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100