Hi, I would like to know why it always need to use...
# orm-help
i
Hi, I would like to know why it always need to use fragment when getting value stored on other type (collection in mongodb) connected via
@relation
? Example
Copy code
type Board {
  id: ID! @id
  boardTitle: String!
  boardDescription: String!
  createdBy: User! @relation(name: "UsersBoard" link: INLINE)
}

type User {
  id: ID! @id
  name: String!
  boards: [Board!]! @relation(name: "UsersBoard")
}
Running
prisma.boards()
will return boards with
boardTitle
and
boardDescription
but not including the
createdBy
field. In order to include it I have to use fragment:
Copy code
const fragment = `
  fragment BoardWithCreator on Board {
    id
    boardId
    boardTitle
    boardDescription
    createdBy {
      name
    }
  }
`;

prisma.boards().$fragment(fragment);
And that will return boards with
createdBy
field. And is there any other way to include
createdBy
field without using fragment?