Is it possible to have nested values when doing a leftJoin?

// returns nested results
export async function getLoans(spaceId: string) { 
  return db.query.loans.findMany({
    where: eq(loans.spaceId, spaceId),
    with: {
      property: true,
      financialInstitution: true,
    },
  });
}

// doesn't return nested results
export async function getLoansLJ(spaceId: string) { 
  return db
    .select()
    .from(loans)
    .leftJoin(
      financialInstitutions,
      eq(financialInstitutions.id, loans.financialInstitutionId)
    )
    .where(eq(loans.spaceId, spaceId));
}

If not, what is your approach when you're not using the query builder? Should I map the results and enrich them based on the financialInstitutionId? Or is there something I missed?
Was this page helpful?