I currently have a collection of documents in firestore. Each of these documents holds an array of json objects. I believe it would be better to store these arrays as sub collections in each document. My only concern is the pricing aspect of reading the sub collection in.
As its just currently an array on each document I believe this counts only as one read (correct me if im wrong) when i fetch a document.
If i move to using a sub collection and read the entire collection with the code below, does this count as one read or multiple? I fear this could be expensive.
db.collection("cities").get().then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
// doc.data() is never undefined for query doc snapshots
console.log(doc.id, " => ", doc.data());
});
});
https://firebase.google.com/docs/firestore/query-data/get-data
Thanks for your help :)