Is there a way to return single record as object from `many` relation using db.query

I want result[0].studio to be an object or null.
const result = await db.query.series.findMany({
with: {
genres: {
with: {
genre: true,
},
},
studios: {
with: {
studio: true,
},
where: (studios, { eq }) => eq(studios.isMain, true),
limit: 1,
},
},
});
const result = await db.query.series.findMany({
with: {
genres: {
with: {
genre: true,
},
},
studios: {
with: {
studio: true,
},
where: (studios, { eq }) => eq(studios.isMain, true),
limit: 1,
},
},
});
1 Reply
Angelelz
Angelelz10mo ago
Not with drizzle yet. You should do your transformations manually
Want results from more Discord servers?
Add your server