Say I am listening on a document:
db.collection("cities").document("SF")
.addSnapshotListener { documentSnapshot, error in
guard let document = documentSnapshot else {
print("Error fetching document: \(error!)")
return
}
print("Current data: \(document.data())")
}
Would each time the data is updated count as a read operation, or does the act of listening count itself, according the Firestore billing policy?
Also, say I am listening on a number of documents:
db.collection("cities").whereField("state", isEqualTo: "CA")
.addSnapshotListener { querySnapshot, error in
guard let documents = querySnapshot?.documents else {
print("Error fetching documents: \(error!)")
return
}
let cities = documents.map { $0["name"]! }
print("Current cities in CA: \(cities)")
}
Will I be charged for a read operation immediately on all documents that match the query or on each update to each document - or both?