How to filter if a variable is not in database
Hi, I am fetching users like:
Now if i dont have a category feild in db in on of user i am getting error:
Instead what i want is to leave that category for that user and send remaining data
5 Replies
Hey 👋
Is categories defined as a required field in your schema.prisma file?
I dont think so:
![No description](https://cdn.answeroverflow.com/1244542403516436570/Screenshot_from_2024-05-27_12-16-51.png)
I opened db and deleted category by myself for one user... Now when i load users it gives error:
In your schema, category is defined as a required field as it doesn't have a (?)
Could you change it to
and after that invoke
npx prisma generate` and then try to invoke the same query?Thanks for the info