?
db.max
The full row holding the largest value of a column.
Query.max(accessor) → Query<T | null>
Returns the whole row holding the largest value of the accessed column, or null over an empty set. Like db.min it hands back the record, not just the number.
Parameters
accessor
(row) => number
RequiredThe column to maximize.
Row with the maximum
const newest = await Posts.max((p) => p.created_at);