【发布时间】:2022-01-02 12:51:52
【问题描述】:
这可能是不可能的,但有办法在 prisma 中创建灵活数量的帖子。例如,我有一个用户,我希望他们创建能够一次创建任意数量的帖子,所以它可以是一个帖子或三个帖子。这可以使用 Prisma 吗?
这是我正在使用的查询:
const user = await prisma.user.update({
where: {
id: 9,
},
data: {
posts: {
// This is where I would like to make the amount of posts being created on the frontend flexible
createMany: {
data: [{ title: 'My first post' }, { title: 'My second post' }],
},
},
},
})
【问题讨论】:
标签: prisma