Sub-field Filtering example

In the 0.28.0 update that removed relation filters, the changelog suggests:

https://github.com/drizzle-team/drizzle-orm/releases/tag/0.28.0

If you have used those fields in the where callback before, there are several workarounds:

  1. Applying those filters manually on the code level after the rows are fetched;
  2. Using the core API.

I'd rather not apply the filter in the code level.

Could someone provide an example of "2. Using the core API." to achieve a basic top level filter based on a sub-field property?
GitHub
Breaking changes
Removed support for filtering by nested relations
Current example won't work in 0.28.0:
const usersWithPosts = await db.query.users.findMany({
where: (table, { sql }) => (...
Was this page helpful?