The structure is as follows, I write on js enter image description here

in the "values" collection, you need to refer to the "income" field, which is in each document, and then output the sum of these fields (they are in numeric format).

I do not understand how to make an appeal to all documents.

    1 answer 1

    let valuesSumm = 0; db.collection("values").get().then(function(querySnapshot) { querySnapshot.forEach(function(doc) { valuesSumm += doc.data().income; }); }); console.log(valuesSumm);