-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nested exists where does not work without id field #275
Comments
Hey @leetmachine 👋, Thank you for reporting this! It would be super helpful if you could provide a small reproduction example - Github repository or CodeSandbox, whichever works best for you. 🙂 |
I have the same issue and created a repository with the code necessary to reproduce the issue https://github.com/leosuncin/prisma-binding_exists-bug More specific the issues is raised here https://github.com/leosuncin/prisma-binding_exists-bug/blob/1dd9e9bfd0937c9c4297834a02f33e1ac0c9b4f5/resolvers/query.js#L2-L9 Moreover, I believe that all this issues #275 #252 #215 are related |
Hey @leosuncin 👋, Thank you for the reproduction! Could you try adding type User {
id: ID! # here
email: String! @unique
name: String!
password: String! @private
bio: String
roles: [Roles!]!
} I believe this should solve your problem because |
I added functional tests to my repository, also I add PS: If someone knows a better way to run tests with Prisma, I'm all ears. |
@leosuncin I agree, however, to my understanding your datamodel doesn't only shape the fields in your database but also portrays the exposed fields. Considering this, not having an |
@maticzav sometimes that's the desire behavior hide a big and not human friendly |
The exists does not work when using a nested where unless the id field is set on the type.
I have the schema:
When I tried to use exists on Employee I received a TypeError: "cannot read property 'length' of undefined' at Prisma.ts:79:31
example exists:
prisma.exists.Employee({ user: { email: '[email protected]'}});
I updated Employee in my Primsa datamodel to include id: ID! and then it was successful (even though I did not change my initial query to use/not use the id.
hopes this helps others!
The text was updated successfully, but these errors were encountered: