Omit type for creating
However, I can use delete user.password. Is there a way to omit the password when creating a new user?
3 Replies
Hi @Myat Min Aung [WE]
You can use the
omit
option to exclude specific fields from the query result, including when creating a new user. You need to enable the omitApi
preview feature in your Prisma schema and run prisma generate
after enabling the omitApi
preview feature to update your Prisma Client.
Then, update your create
method to use the omit option:
https://www.prisma.io/docs/orm/prisma-client/queries/excluding-fieldsExcluding fields | Prisma Documentation
This page explains how to exclude sensitive fields from Prisma Client
Thanks for the guidance; I appreciate it.
You're welcome 🙏