Help with this relational query?

I am trying to get all the organizations that a member is associated with.

This code is working:

await db.query.membership.findMany({
  columns: {},
  where: eq(membership.userId, sessionUser.userId),
  with: {
    organization: true
  }
});


But it is outputting this:

[
  { organization: { id: 19, name: "Testing123" } },
  { organization: { id: 20, name: 'test' } },
  { organization: { id: 21, name: 'Place 4012 } },
  { organization: { id: 22, name: 'Foo' } }
]

I know I could just transform this easily with JS, but I wonder if I writing the initial code wrong. I just want an array of organizations.
Was this page helpful?