Add ability to update relation fields inside `updateMany`
See original GitHub issueProblem
Given this schema:
model Booking {
worker Worker
}
If we want to disconnect multiple bookings at once, we currently have to run a separate update
call for each individual booking:
await Promise.all(bookings.map(booking => {
return prisma.booking.update({
data: { worker: { disconnect: true } },
where: { id: booking.id }
})
}))
Suggested solution
It would be really nice if we could do something like this instead:
return ctx.prisma.booking.updateMany({
data: { worker: { disconnect: true } },
where: { id: { in: bookingIds } }
})
Issue Analytics
- State:
- Created 3 years ago
- Reactions:74
- Comments:10
Top Results From Across the Web
Relation queries (Concepts) - Prisma
A key feature of Prisma Client is the ability to query relations between two or more models. Relation queries include: Nested reads (sometimes...
Read more >Updating a many-to-many relationship in Prisma
Here is what I'd like to do. Get a post with category ids attached to it and insert it into the schema above....
Read more >Update Multiple Documents using updateMany() in MongoDB
Learn how to update multiple documents using the updateMany() method in MongoDB. ... The following will update or add location field in all...
Read more >How Can I update data with lookup - MongoDB
I want to update collection A on based on Collection B field. My query like this, db.a.updateMany(condition,{$set:{ "productMinQty":collection b ...
Read more >MongoDB - Update Document - Tutorialspoint
MongoDB's update() and save() methods are used to update document into a collection. The update() method updates the values in the existing document...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
any updates?
Can anyone advise if this is on the roadmap?