mongoose-beautiful-unique-validation
mongoose-beautiful-unique-validation copied to clipboard
Are all errors supposed to be returned?
Hi and thanks for the plugin!
From the documentation I understand that all the validation errors should come at once. However, it is returning one error only.
For example, I have two unique fields in my schema (username and email). If I try to create a document where neither username nor email are unique the response I get is only saying that the email is not unique. However if I change the email to something unique and leave the username as before, then I receive a response saying that the username is not unique.
Is this the intended behavior? Or should I be receiving one response with all the validation errors?
Thanks in advance!
I think it is intentional, since it stops as it hits the first error it catches that is why. So it doesn't hit an error and continue to catch the rest, but just stops at the first error it reaches and throw it.