does prisma support batching? i can't find any doc...
# orm-help
p
does prisma support batching? i can't find any docs on how to update multiple entries at once
h
Hey 👋 Not sure about batching/running multiple queries at once, but Prisma has an
updateMany
function to update multiple entries at once 😄
p
yeah, i need batching, since all of my documents should be updated differently, and I have lots of them (tens or even hundreds at the same time)
h
Try my solution and see if it works
👎 1
n
Hey @PinkiePie 👋 you can use the
$transaction
API to send multiple Prisma Client operations in a single batch: https://www.prisma.io/docs/concepts/components/prisma-client/transactions#sequential-prisma-client-operations Otherwise
updateMany
should also be a good option! Let me know if that helps or if you have further questions 🙂
p
@nikolasburk my question was related to mongo, so I've re-asked it in mongodb channel: https://prisma.slack.com/archives/C0281DB57HQ/p1656395218035119. Long story short,
$transaction
runs a bunch of sequential requests, instead of batching. Seems like I really need a batching via
$runCommandRaw
or I'll have to use both Prisma and native mongo driver for the cases like this.
👍 1
🙏 1