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,
      },
    },
  });
Was this page helpful?