Hello, how can I perform a nested update on many t...
# orm-help
h
Hello, how can I perform a nested update on many to many relationships without adding where clause
n
Hey Hussein 👋 Can you please provide a basic schema describing your models and query which you are trying to execute? Here is a generic example of how you could achieve nested updates.
Copy code
const result = await prisma.user.update({
  where: {
    id: 2,
  },
  data: {
    posts: {
      updateMany: {
        where: {
          published: false,
        },
        data: {
          likes: 0,
        },
      },
    },
  },
})
You can learn more about nested updateMany from this reference