PatchPrivatePreviewFeedbackGroup icon indicating copy to clipboard operation
PatchPrivatePreviewFeedbackGroup copied to clipboard

User Feedback Requested : Increment an property that doesnt exist

Open sharan779 opened this issue 3 years ago • 3 comments

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" ? image

Let us know your comments ?

sharan779 avatar May 26 '21 07:05 sharan779

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.

WWeichselberger avatar May 28 '21 15:05 WWeichselberger

I agree with @WWeichselberger and there is similar functionality for MongoDB: https://docs.mongodb.com/manual/reference/operator/update/inc/

image

fmamic avatar May 31 '21 16:05 fmamic

+1 for the Keep it Simple, and Keep it familiar to other database systems where we can already do this.

ryancrawcour avatar Jun 25 '21 03:06 ryancrawcour