【发布时间】:2022-10-14 04:35:53
【问题描述】:
我正在尝试在 Prisma 的复合类型模型中实现更新。
这是我的数据结构:
{
"name":"toy",
"data":{
"sports":{
"currentState":"false"
},
"business":{
"currentState":"false"
}
}
}
这是我的更新代码:
const updatedSource = await prisma.sources.update({
where: {
name: 'toy'
},
data: {
data: {
sports: {
currentState: "true"
}
}
},
})
这是我的架构文件
type SourcesData {
business SourcesDataState
sports SourcesDataState
}
type SourcesDataState {
currentState StateData[]
}
type StateData {
title String
url String
}
model sources {
id String @id @default(auto()) @map("_id") @db.ObjectId
data SourcesData
name String @unique
}
当我执行上述逻辑时,我得到错误:Unknown arg `sports` in data.data.sports for type SourcesDataUpdateEnvelopeInput. Did you mean `set`? Available args:
请指导我在更新时缺少的内容。
【问题讨论】:
-
您可以在问题中添加您的架构文件吗?
-
@Nurul Sundarani,我添加了架构文件
标签: prisma