n
d
User is not an array, it is a relation to a list of users so should use
connect
or
create
something like:
Copy code
data: {
  likes: {
    connect: {
      id: 'id'
    }
  }
}
let me double check the syntax
n
this.commentService.updateComment({
where: { id: commentID },
data: {
likes: {
connect: {
id: commentID
}
}
},
});
This worked out great for me, could you tell me what ‘create’ changes in this case? Would it create a new user or am I misunderstanding its purpose
d
yes, but you want to connect the user
n
yeah my bad, it should’ve been id: userID
d
connect, connects to an existing user, you want to use create if you want to create in the same action
n
perfect, that’s what I thought
many thx!
d
I use explicit join tables a lot so I dont connect, I create a join
no worries