I am trying to retrieve the documentIDs where the fields is the users email-adresse.
This is what have tried:
let emailID = Auth.auth().currentUser!.email!
let db = Firestore.firestore()
let vehicleArray = db.collection("Users").whereField("Email", arrayContains: emailID)
.getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")
} else {
for document in querySnapshot!.documents {
let vehicleArray2 = document.documentID
print(vehicleArray2)
}
}
}
let print(vehicleArray)
The problem is that I get nothing then I print the vehicleArray, because the data from firestore are a string. The question is how can I get it in an array?
My Firebase Database looks like this:
Thank you very much in advance for your help.