-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Writing a robust updatedAt autoValue #419
Comments
Indeed, it feels quite verbose versus a much intuitive schema you provided. I'd happily accept a PR that updates the docs. We could definitely provide certain helpers like https://github.com/aldeed/meteor-schema-deny @StorytellerCZ @coagmano Your input is greatly appreciated guys. |
I'm fine with adding additional directives like I like the thinking behind We either should bring schema-deny under community maintenance as well or if my memory serves me right there was a talk about re-integrating it and |
It seems to me that this could be easily solved by just having two top level fields, updatedAt and updatedBy. Keeping anything else from modifying the field is as simple as calling unset if the operation isn't an update or upsert.
|
Yeah, nested objects always add a lot of extra headaches with simple schema, even though the compartmentalisation helps avoid clutter when looking through objects. Anyways, I think @copleykj is fairly straightforward. |
In the docs, there is a very helpful example of how to define a
updatedAt
field that stores a date on each update.We've found for our use case, that storing the
updatedBy
is very helpful to trace things down to the user who performs the update.However, it has proven to be quite difficult to write that in a nested way like this, without any way to bypass the schema:
The following collection operations each should behave:
So here's what that schema looks like:
I find it a bit intense that you need to add all these extra bits to prevent any wrongdoing, where the specs are pretty simple to write in words:
Does someone know of a simpler way to do this? I think it'd be useful to add to the docs, as this is a simple piece of information that can be helpful in all meteor codebases :)
The text was updated successfully, but these errors were encountered: