I mentioned this in #datomic and wanted to make sure it gets some visibility as the behaviour can be very misleading.
; find entities whose :user/name attribute has a value of "user123"
(d/q '{:find [?e]
:in [$ ?v]
:where [[?e :user/name ?v]]}
db "user123")
=> [[12345678912345]]
; find entities with any attribute that has a value of "user123"
(d/q '{:find [?e]
:in [$ ?v]
:where [[?e _ ?v]]}
db "user123")
=> []
The only difference between these two queries is the specified vs. unspecified attribute ident. I understand that the second query is incredibly inefficient and should be avoided, however I would expect an exception akin to a full DB scan. An empty set can be very misleading as it is technically not true.
Interestingly enough, this works:
(d/q '{:find [?e ?b]
:in [$ ?v]
:where [
[?a :db/ident ?b]
[?e ?a ?v]]}
(client/db) "user123")
=> [[12345678912345 99]]
(Someone else in #datomic was able to reproduce the same behaviour: https://app.slack.com/client/T03RZGPFR/C03RZMDSH/thread/C03RZMDSH-1572805960.062200)
Cheers!