?
db.take
Limit a query to the first n rows (SQL LIMIT).
Query.take(n) → Query<T[]>
Caps the query at n rows with SQL LIMIT. Chain it after sortBy for top-n reads, and with skip for pagination. It bounds the work in the database, not after the fetch.
Parameters
n
number
RequiredMaximum rows to return.
Top-n read
const top10 = await Posts .sortBy((p) => p.score) .reverse() .take(10);