© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
2 replies
IstoraMandiri

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
Release 0.28.0 · drizzle-team/drizzle-orm
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 }) => (...
Release 0.28.0 · drizzle-team/drizzle-orm
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Filtering
Drizzle TeamDTDrizzle Team / help
3y ago
limiting a join when filtering by an extra field.
Drizzle TeamDTDrizzle Team / help
2y ago
Optional filtering
Drizzle TeamDTDrizzle Team / help
3y ago
Nested relation filtering
Drizzle TeamDTDrizzle Team / help
14mo ago