-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
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
Default Values #19
Comments
The simple-schema package doesn't have this because the assumption is that you would set default values on the object before validating it, but there is development underway to add an |
The question is: if I define a
The first purpose of So we need another option in the schema definition to handle the default value use case:
Thoughts? |
My thinking was that if a user passed in a document without a field that had an So for example, if I was tracking the number of comments on a post and a new post was created, the comments field would default to 0 rather than undefined. Of course, there are many ways around this such as setting If something is implemented in the future though, I'm in favor for a |
The
Then we would always overwrite unless they returned undefined. |
Closing this since it's being addressed in collection2 package. |
Is there a way to set default values? Not sure if the schema is the place to set defaults but I'm thinking it would be nice in some cases.
The text was updated successfully, but these errors were encountered: