Is it possible to return has many relationship load to return a single object instead of an array.
output
desired output
db.query.products.findMany({
orderBy: (model, { desc }) => desc(model.createdAt),
with: {
discounts: {
where: (model, { eq }) =>
eq(model.organizationId, session.organizationId),
limit: 1,
},
},
}),[
{
id: 1,
discounts: [ [Object] ]
}
][
{
id: 1,
discounts: Object
}
]