Hi all. Suppose I have ``` type Post { id: ID!...
# orm-help
h
Hi all. Suppose I have
Copy code
type Post { 
  id: ID!
  comments: [Comment!]!
}
type Comment {
  id: ID!
  user: User!
  comment: String!
}
What is the best way to append a new comment to the post? If I add a field
post: Post!
into
Comment
, it feels too verbose. Is it a common way to always implement 2-way relations?
n
Are you asking about designing the datamodel, or about adding data via a mutation? Your first question suggests the latter, while your second question suggests the former.
h
I want to ask about mutation. Currently I implemented this by
prisma.updatePost({ where: id, data: { comments: { create : { ... } } })
n
Yup, this is the way to do it.