The following code as an example, I am confused about after which numbered line I will be charged for reads in the query result.
I do I understand the info mentioned in this stackoverflow answer, I feel lost in something and I would appreciate some guidance in this.
docRef
.collection('comments')
.orderBy('createdAt', 'desc')
.get() // #1 <---------
.then(querySnapshot => { // #2 <---------
const commentCount = querySnapshot.size // #3 <---------
const recentComments = []
querySnapshot.forEach(doc => { // #4 <---------
recentComments.push( doc.data() )
});
recentComments.splice(5)
const lastActivity = recentComments[0].createdAt
const data = { commentCount, recentComments, lastActivity }
return docRef.update(data)
})
.catch(err => console.log(err) )