I’ve got an account model that has interests, which is an array of strings (db.type=string and cardinality=many). For example:
{:id 42
:name "Test"
:interests ["cars" "games" "etc"]
:age 50}
Then another list of interests come from the request. How can I query accounts what have ALL the specified interests?
For example, for ["cars" "games"]
I'll get the account #42 since it includes the passed list. But for ["cars" "games" "books"]
I won't because "books"
is an extra one.
UPD
What I have is:
;; model
{:db/ident :account/interests
:db/valueType :db.type/string
:db/cardinality :db.cardinality/many
:db/index true}
;; a query
[:find ?id
:id $ [?interest ...]
:where
[?a :account/interests ?interest]
[?a :account/id ?id]]
So how should I build a Datomic query?