有一個具有唯一名稱的陣列,我如何使用 prisma(在 nextjs 中)更新這些名稱的元素。我的意思是:
const arr=['Joe', 'Mark'];
const update=await prisma.user.updateMany({
where: {
name: //What should i put to update both Joe and Mark?
},
data: {
notifications: {push: "Hello"}
}
});
我正在使用 PSQL,但我不知道它是否重要。
uj5u.com熱心網友回復:
嘗試這個:
const arr=['Joe', 'Mark'];
const update=await prisma.user.updateMany({
where: {
name: {in: arr}
},
data: {
notifications: {push: "Hello"}
}
});
"in" 將檢查名稱是否匹配該陣列中的任何內容。以下是其他過濾器的串列:https ://www.prisma.io/docs/reference/api-reference/prisma-client-reference#filter-conditions-and-operators
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/497616.html
標籤:javascript 下一个.js 棱镜
