Linked Questions

Popular Questions

Firestore database trouble querying Swift

Asked by At

I need to query the chats: enter image description here

Right now I have this:

db.collection("users").document((Auth.auth().currentUser?.uid)!).collection("chats")
        .addSnapshotListener { documentSnapshot, error in
            guard let snapshot = documentSnapshot else {
                print("Error fetching document: \(error!)")
                return
            }

But all the examples I see only show how to read a single document. In this case I need to save a Chat object with a string array members and a name. I dont know how to get to each of the members and name fields if i dont have the chat auto id saved.

Related Questions