crc3.
crc3.
DTDrizzle Team
Created by crc3. on 1/27/2024 in #help
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,
},
},
});
2 replies