-
Notifications
You must be signed in to change notification settings - Fork 0
Strict add operator #3
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
Comments
s/their/there. [ashamed face] |
I'm generally +1 on this as well. While the "add-acts-like-replace-for-existing-keys" behavior can be convenient in some cases, it also means that It makes #2 much easier if |
This feels similar to the upsert problem, reversed. Most database systems offer insert and update, but no upsert (aka "update if it exists, insert if not"). JSON Patch has upsert (add) and update (replace), but no insert — which could therefore be the operation name. As a side-note, this is addressed by #14 as well. |
This can be achieved using JSON Predicate [
{"op": "undefined", "path": "/foo"},
{"op": "add", "path": "/foo", "value": "bar"}
] I've implemented it in |
( from John Huffaker)
In concurrent modification scenarios test plus add/replace work great to avoid one user silently overwriting another user's modifications. The problem occurs when two users try to both add the same key (with different values) concurrently.
The test operator can't check for non-existence and their is no strict add operator that fails if the key already exists. I could resort to some other form of course grained locking but I really like the fine grained optimistic locking allowed by the current spec. Is a strict add operator on the horizon or should we add a non-standard operator to handle our use-case?
The text was updated successfully, but these errors were encountered: