"where" clause not found in "with" object
Hi, I'm trying to write a "where" clause inside a with object. I.e. I'm trying to filter events that are in certain dates in this query. The ide complains that "where" is not found. However documentation says it should work. Have a look here: https://orm.drizzle.team/docs/rqb#find-many
Where am I going wrong?
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
3 Replies
Currently you can't filter based on relations in the relational query builder.
So no filtering in the
with
part.
You'll probably have to go back to a normal query.
But I think this is planned to be added back in (it was removed because it destroyed the typescript server as I remember it.)I'm not sure that's the case, I tried to replicate on my code and it works just fine
Can you share your drizzle version ? and also please share the part where you initiate the relation between schema
I found the bug folks. Looks like where clause under a "with" works unidirectionaly on a one-to-many relationship. So I could do the same lookup from events or genres table for eventGenres but not the other way around.