Skip to content

sum

To sum document field values, use the sum method. It’s available on Collection, query, or collection group.

await db.users.sum("age");
//=> 42069

The method returns Promise<number>.