i am using prisma image 1.34 I have a small issue trying to implement the prisma.exists method with mongodb atlas.
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)
}
}
the error I got is
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)
when I remove the code related to prisma.exists the resolver runs successfully , also I did verify that the argument "args.id" is pulled successfully
**Versions
Prisma Server: [1.34.1]
prisma CLI: [1.34.1 ]
OS: [Windows 10 home edition]
docker toolbox
Are you using the client or the bindings? According to the prisma documentation the syntax should be as follows:
See: https://www.prisma.io/docs/1.34/prisma-client/features/check-existence-JAVASCRIPT-pyl1/