Skip to content

average

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

await db.users.average("age");
//=> 42

The method returns Promise<number>.