Changelog - 2026-05-25
Per-Model Default Limit
New FeatureIn one line. Models can declare their own default page size instead of sharing one limit of 10 rows.
What changed
- New
settings.defaultLimit. A per-model positive integer used when a query omitslimit. - Precedence.
query.limit ?? settings.defaultLimit ?? DEFAULT_LIMIT (10). An explicitlimitalways wins. - Where it applies. Top-level
find()and every to-many relation. Each relation uses its own model'sdefaultLimit. - Boot-time check.
@modelthrows ifdefaultLimitis not a positive integer. - Default filter. Bypassing it with
shouldSkipDefaultFilterdoes not drop the default limit.
typescript
@model({
type: 'entity',
settings: { defaultLimit: 200 },
})
export class Country extends BaseEntity<typeof Country.schema> {
static override schema = pgTable('Country', {
/* ... */
});
}
await countryRepo.find({ filter: {} }); // LIMIT 200
await countryRepo.find({ filter: { limit: 10 } }); // LIMIT 10Who is affected
- Models that never set
defaultLimit. No action needed. They stay capped at 10 rows. - Small lookup tables and large tables. Each can now set its own default.
Details
- There is no "unbounded" value. To fetch more rows than the default, pass an explicit
limitin the query. - This makes the consistent default limit configurable per model.