This is my data model ``` type User { id: ID! @i...
# orm-help
t
This is my data model
Copy code
type User {
  id: ID! @id
  firstName: String!
  lastName: String @default(value: "")
  email: String! @unique
  passwordHash: String
  emailVerified: Boolean! @default(value: false)
  verifyToken: String
  avatar: String
  userSource: UserSource!
  identities: [Identity!]
  createdAt: DateTime! @createdAt
  updatedAt: DateTime! @updatedAt
}

type Identity {
  id: ID! @id
  service: ServiceType!
  serviceId: String!
  username: String!
  email: String!
  name: String
  accessToken: String! @db(name: "access_token")
  tokenType: String! @db(name: "token_type")
  expiresAt: DateTime @db(name: "expires_at")
  refreshToken: String! @db(name: "refresh_token")
  idToken: String @db(name: "id_token")
  user: User! @relation(link: INLINE)
}
I'm trying to list identities and get the email from array of identities like this:
Copy code
const id = await prisma
              .user({ id: user.id })
              .identities({
                where: {
                  service: USER_SOURCE.GOOGLE,
                },
              });
console.log(id.email);
When I
console.log(id)
, I can see all the values but
console.log(id.email);
shows nothing to me
h
id is an array so that you can't access email directly. Try
id[0].email
if you want to access the first element or map over the array to get an array of emails