Thank you very much for your help,
But suppose this is great if this code is not included in the package because I can validate the collections with minimal code.
And it didn’t matter if the information was from the server or the client, in both cases, the information and the inputs were validated. And an accurate message from the wrong input was displayed.
This is much better than giving a vague message to the user. (For example, the password field must be at least 8 digits).
And it is better than validation in methods.
I think modifying this line of code in the Collection2 package will make the code much more efficient.
If you think this is true and you agree with me, I will give you a pull request.
I do not think this is a good idea for a pull request, as I rely on knowing what collection the validation error is coming from in order to debug issues. Otherwise the error message will be useless for logs or debugging, which is it’s primary purpose
Validation against a collection is primarily meant for developers, not the users.
The ideal flow of validation is something like this
User submits input -> client side validation -> server method validation -> business logic validation -> collection validation
Our client side, server method, and collection validations all use simpleschema. But only the first 2 are user-facing with user-friendly error messages. When collection error happens in production, we display a generic error to the user and log the actual error for developers to check. For us, ideally, collection schema error must not happen in production
You are right, but it can be more concise and practical.
If debug and non-debug mode is set for the Collection2, all these steps can be summarized in the validation of the Collections.
For example, in debug mode, show the name of the collection and not in non-debug mode.
With this method, what is the real need for validation, Methods and Fronts ?!
I won’t try to convince you if you don’t appreciate the differences between the different validations. It is not a smart move to remove the collection name from the error message from simpleschema. If you need something that suites you, you can always fork and rollout your own. That is the beauty of opensource