I want to update multiple posts with one mutation

prisma

#1

type post{
id: ID
title: String!
url: String!
}

this is my post, and there are array of things I want to update.
ex) title[“a”, “b”, “c”], url[“aaa”,“bbb”,“ccc”]

postupdate is available in prisma but I want to update multiple posts at one mutation with id list.

export default {
Mutation: {
updatePost: async (_, args) => {
const post = await prisma.updatePost({
data: {
title: list[0].title,
url: list[0].url,
time: list[0].time
},
where: {
id: id_list[0]
}
});
return post;
},

like this. please help me


#2

Hi,

Since you have different data for different post, this operation will not be possible via updateMany mutation.

You will need to use updateMutation only


#3

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.