我正在使用 prisma image 1.34 我在尝试使用 mongodb atlas 实现 prisma.exists 方法时遇到了一个小问题。
type Business {
_id: ID! @id
name: String!
desc: String!
published: Boolean!
author: User! @relation(name: "BusinessUser", link: INLINE)
async updateBusiness(parent, args, { prisma, request }, info) {
const postExists = await prisma.exists.Business({
_id: args.id,
})
if (!postExists) {
throw new Error('Unable to update post')
}
return prisma.mutation.updateBusiness({
where: {
_id: args.id
},
data: args.data
}, info)
}
}
我得到的错误是
TypeError: Cannot read property 'length' of undefined
at C:\Users\jarid\Desktop\Alfarouk\alfarouq\Backend\node_modules\prisma-binding\src\Prisma.ts:86:31
at process._tickCallback (internal/process/next_tick.js:68:7)
当我删除与 prisma.exists 相关的代码时,解析器运行成功,我也验证了参数“args.id”是否已成功提取
**版本
Prisma Server: [1.34.1]
prisma CLI: [1.34.1 ]
OS: [Windows 10 home edition]
docker toolbox