Hi, is there a way to automatically create connect...
# orm-help
a
Hi, is there a way to automatically create connect and disconnect a many relationship in one call. For example if I have a Post with Tags. Tag is an entity in the DB. The user can update the tags of the Post on the frontend, disconnect some, connect others, and create or connect new ones. This kind of behavior was done implicitly by TypeORM
n
Hey Adrian 👋
Copy code
const user = await prisma.post.update({
  where: { title: 'prisma' },
  data: {
    tags: {
      set: [{ id: 2 }, { id: 3 }, { id: 4 }],
    },
  },
})
The above example should do what you are trying to achieve, please note that set overrides any existing values, so previous tags would be removed and instead tags with id - 2,3,4 would be set.