PatchPrivatePreviewFeedbackGroup
PatchPrivatePreviewFeedbackGroup copied to clipboard
User Feedback Requested : Increment an property that doesnt exist
Do you think Increment op should be a blind increment operator, meaning that the user might want to increment a property that might not even exist.
In this case, would you vote for having a default value of 0 or an extra optional parameter "ifNotExists" ?
Let us know your comments ?
My opinion on this: Keep it simple!
- No optional parameter
- If the property does not exist, it is initialized with 0 and incremented from there.
This should be just fine for most use cases. Anything more complicated (init value != 0; require already existing property) could be done with conditional patches.
I agree with @WWeichselberger and there is similar functionality for MongoDB: https://docs.mongodb.com/manual/reference/operator/update/inc/
+1 for the Keep it Simple, and Keep it familiar to other database systems where we can already do this.