findMany with custom field
Currently, I have a code to fetch order details by aggregating several tables (Order, Customer, and Order Line Items tables). I've read the documentation about
The code currently can return something like below
I want to fetch
.findMany() and this is what I'm able to doThe code currently can return something like below
I want to fetch
name from Service Table, and replace serviceId with it where serviceId = service.id. How can I achieve that? I've read https://orm.drizzle.team/docs/rqb#include-custom-fields but I still can't get it to work.Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Solution
It's not possible with query api.
But you can add a relation for Order Line Items table to get your service (you will then be able to add a
For the final mapping shape, it will be in pure JS.
But you can add a relation for Order Line Items table to get your service (you will then be able to add a
with in orderLineItems).For the final mapping shape, it will be in pure JS.