Sum of ints and floats in an array

I have a q: im hoping you can help with.

If I store an array of ints/float, is there any way to get a sum of these at request time?

thks

Hi! yes you can sum those with UNNEST. Let’s say we have a collection foo and array column in that table col. There are 2 documents in this collection:

{"col": [1, 2.5]}
{"col": [2, 3.5]}

You can use UNNEST to get the sum of each row

SELECT
    SUM(unnested_table.c)
FROM
    commons.foo h,
    UNNEST(h.col AS c) AS unnested_table
GROUP BY h._id