Using the getDocument command on Firebase

On a personal project I’m trying to retrieve data from my firebase database and am getting a problem where the code just jumps straight over the getDocument part and doesn’t go into the closure (code copied below). I don’t really understand why this would be happening. Hope you can help!

let db = Firestore.firestore()

db.collection(“questions”).document(“doc”).getDocument { (snapshot, error) in

if error != nil || snapshot == nil {
      return
}

}

Hi Alex,

Can you post a screenshot of your Firebase Database Console screen for the record(s) that you are trying to retrieve?

If your database is, say, a whole lot of questions then you would retrieve all of them with:

db.collection("questions").getDocuments { (snapshot, error) in

Hi Chris,

I managed to find a solution to this problem, but thank you for trying to help and replying so quickly!

Please post your solution!!
Others may have the same question