This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Is it possible to define a pull query that returns two documents if both exists and either one if only other exists? I might have both documents readily available or not, ie. result missing. I could query them separately of course, but having them in a single query would be nice.
(xt/q (xt/db db) ;; returns nil IF r does not exist
'{:find [(pull r [*])
(pull e [*])]
:where [[e :xt/id id]
[e :expense/type type]
[r :result/e e]]
:in [[type ...] id]}
valid-types id)
Docs do state that
> The :where
section of a query limits the combinations of possible results by satisfying all clauses and rules in the supplied vector against the database (and any :in
relations).
If it satisfies all clauses, I guess my wish won't happen