If I have a simple collection such as:
Fruits:
Banana:
title: \"Banana\"
vitamins: [\"potassium\",\"B6\",\"C\"]
Apple:
title: \"Apple\"
vitam
It would be tempting to to look for documents that match multiple conditions, by chaining the conditions in the query:
db.collection("Fruits")
.whereField("vitamins", arrayContains: "B6")
.whereField("vitamins", arrayContains: "C")
But the documentation on compound queries suggests that you cannot currently have multiple arrayContains conditions in a single query.
So, it is not possible with what you have today. Consider instead using a map structure instead of an array:
Fruits:
Banana:
title: "Banana"
vitamins: {
"potassium": true,
"B6": true,
"C": true
}
Then you could query like this:
db.collection("Fruits")
.whereField("vitamins.B6", isEqualTo: true)
.whereField("vitamins.C", isEqualTo: true)