We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check()
In Creating Posts the following code is added to lib/collections/posts.js to validate postAttributes:
lib/collections/posts.js
postAttributes
check(postAttributes, { title: String, url: String });
However, this provides no enforcement on string length and thus allows the user to submit an empty form, creating a document with empty attributes.
According to the Match Patterns documentation, the correct approach is to use Match.Where(condition) to ensure the string is not empty:
Match.Where(condition)
NonEmptyString = Match.Where(function (x) { check(x, String); return x.length > 0; }); check(postAttributes, { title: NonEmptyString, url: NonEmptyString });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In Creating Posts the following code is added to
lib/collections/posts.js
to validatepostAttributes
:However, this provides no enforcement on string length and thus allows the user to submit an empty form, creating a document with empty attributes.
According to the Match Patterns documentation, the correct approach is to use
Match.Where(condition)
to ensure the string is not empty:The text was updated successfully, but these errors were encountered: