updateMany many-to-many relations #2231
-
Hey guys, i have a situation here where i feel like i hit some prisma limitation i can't workaround yet. I got a simple chat and i need to mark messages as "read" by particular users to mark it visually for other users. When i first approached this, i thought it's as simple as updating the
But i quickly realized it's not possible with prisma, and updating every single message in a loop just hangs the prisma for me if there are more than 100 messages. Any advice on how should i implement functionality like this? Also, wanted to understand why prisma adds non-scalar fields to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @ilya-lopukhin 👋 prisma.chat.update({
where: { id: 1 },
data: {
seenBy: {
connect: [{ id: 1 }, { id: 2 }, { id: 3 }],
},
},
}) This will update the seen for all users specified in connect |
Beta Was this translation helpful? Give feedback.
Hey @ilya-lopukhin 👋
Did you try writing it like this?
This will update the seen for all users specified in connect