Fork me on GitHub
#datascript
<
2016-10-13
>
afhammad19:10:47

How can I run a query that returns all :card/number ids where :card/tags (cardinality/many) has at least one of :tags/selected (cardinality/many) OR return ids for ALL :card/number if :tags/selected is empty. this satisfies the first part, but obviously returns nothing if ?tag-ids is empty

[:find [?e ...]
 :where
 [_ :tags/selected ?tag-ids]
 [?e :card/number]
 [?e :card/tags ?tag-ids]]