У меня есть такая структура базы данных в Cloud Firestore of Firebase:
{
"Club": [
{
"name": "club one",
"address": "via Roma",
"owners": [
{
"name": "Mario Rossi",
"id": "1"
},
{
"name": "Giorgio Verdi",
"id": "2",
}
]
},
{
"name": "club two",
"address": "via milano",
"owners": [
{
"name": "Giorgio Verdi",
"id": "2"
}
]
}
]
}
Я бы хотел получить в Swift 4 все клубы, у которых есть владелец с id = 2.
Этот код не работает для меня:
let citiesRef = db.collection("clubs")
.whereField( "owners", arrayContains: 2)
.getDocuments()
Это реальная структура базы данных:
