[X] I have verified that the bug I'm about to report hasn't been filed before.
What version of drizzle-orm are you using?
0.35.2
What version of drizzle-kit are you using?
0.26.2
Other packages
No response
Describe the Bug
Let's assume I have Batches and BatchItems of Batches (one to many). I want to find all batches with the count of batchItems in each batches in query.findMany. I got this from the docs and it's clearly not working:
I tried that:
Using db.$count()
But it's not a good way and why the first method is changing the table name?
Btw, itemsCount gives a string not a number used .mapWith(Number) didn't work
Report hasn't been filed before.
What version of
drizzle-orm
are you using?0.35.2
What version of
drizzle-kit
are you using?0.26.2
Other packages
No response
Describe the Bug
Let's assume I have Batches and BatchItems of Batches (one to many). I want to find all batches with the count of batchItems in each batches in
query.findMany
. I got this from the docs and it's clearly not working: I tried that: Usingdb.$count()
But got that error:
PostgresError: column batches.batch_id does not exist
It's working if I do this:
But it's not a good way and why the first method is changing the table name? Btw,
itemsCount
gives a string not a number used.mapWith(Number)
didn't work