Changelog - 2026-11-07
A caller's where cannot replace the default filter
Security Breaking ChangeIn one line. A model's default filter (isDeleted = false, deletedAt IS NULL) could be replaced by a caller's where on the same field: where: { isDeleted: true } returned the soft-deleted rows of the caller's scope. A caller's where can only narrow the default now.
What changed
- No override. When the default filter and the caller's
whereboth set a field, the two conditions AND-compose, scalars included.where: { isDeleted: true }against the defaultisDeleted: falsematches no row. - Restating the default is a no-op.
where: { deletedAt: null }with the defaultdeletedAt: nullis the same query as without it. - Every path. Reads (
find,findOne,count),updateBy,deleteByand thescope.whereof an included relation, which merges with the related model's own default. - Not only soft delete. The rule is on the default filter, whatever field it sets: a default
status: 'live'is not replaced bywhere: { status: 'archived' }either. - The server opts out explicitly.
options: { shouldSkipDefaultFilter: true }on the repository call (and on an include) reads or changes the rows the default hides. It is not on the wire schema, so a request cannot send it. The access scope (settings.access) still applies on top. - Unchanged. Operator objects,
andandorcomposed as before, a caller'sundefinedstill never replaces a default, and keys only one side sets pass through.
Who is affected
- Server code that read deleted rows with
where: { isDeleted: true }(a trash view, a restore screen) or that overrode another default field. PassshouldSkipDefaultFilter: trueinstead. - Clients that sent
where: { deletedAt: null }or the other restated default. Still works; it is a no-op and can be dropped. - Everyone else. No action needed.
Breaking changes
WARNING
A where that sets a field the default filter sets no longer replaces the default.
Before:
typescript
// Returns the deleted rows
await postRepository.find({ filter: { where: { isDeleted: true } } });After:
typescript
// The same call returns nothing. Server code that wants the deleted rows says so:
await postRepository.find({
filter: { where: { isDeleted: true } },
options: { shouldSkipDefaultFilter: true },
});shouldSkipDefaultFilter drops the whole default filter, not only the soft-delete condition. If the model's default holds other conditions you still want, state them in the where.
Details
| File | Package |
|---|---|
src/relational/core/repositories/dialect/filter.ts | connectors |