Hello,
Let’s imagine i have a schema like :
User {
id : ID
email : String
name :String
}
I would like to verify if the field “email” already exist in the database before doing a mutation.
I would like to avoid having 2 users with the same email.
How can i make sure of this uniqueness?
Should I create a logic first that does a graphql query and retrieve all the user with this email in the database and if the email already exists i dont execute the mutation?
Is there any Graphql type/feature that would declare the field “email” as unique and would return an error on the mutation request if the email exists?
What is the best way to make sure a field is unique?
Best regards