-
Notifications
You must be signed in to change notification settings - Fork 335
Did some language clean up / clarification on JSON.MERGE
documentaiton page.
#1065
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
Merge a given JSON value into matching paths. Consequently, JSON values at matching paths are updated, deleted, or expanded with new children. | ||
|
||
This command complies with [RFC7396](https://datatracker.ietf.org/doc/html/rfc7396) Json Merge Patch | ||
This command complies with [RFC7396](https://datatracker.ietf.org/doc/html/rfc7396) JSON Merge Patch | ||
|
||
[Examples](#examples) | ||
|
||
## Required arguments | ||
|
||
<details open><summary><code>key</code></summary> | ||
|
||
is key to merge into. | ||
is the key to merge into. | ||
</details> | ||
|
||
<details open><summary><code>path</code></summary> | ||
|
||
is JSONPath to specify. For non-existing keys the `path` must be `$`. For existing keys, for each matched `path`, the value that matches the `path` is being merged with the JSON `value`. For existing keys, when the path exists, except for the last element, a new child is added with the JSON `value`. | ||
is the JSONPath to specify where in the JSON document to apply the merge. For non-existing keys the `path` must be `$`. For existing keys, for each matched `path`, the value that matches the `path` is merged with the JSON `value`. For existing keys, when the path exists, except for the last element, a new child is added with the JSON `value`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just remove the "the" |
||
|
||
</details> | ||
|
||
<details open><summary><code>value</code></summary> | ||
|
||
is JSON value to merge with at the specified path. Merging is done according to the following rules per JSON value in the `value` argument while considering the corresponding original value if it exists: | ||
is the JSON value to merge with at the specified path. Merging is done according to the following rules per JSON value in the `value` argument while considering the corresponding original value if it exists: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
* merging an existing object key with a `null` value deletes the key | ||
* merging an existing object key with non-null value updates the value | ||
* merging a non-existing object key adds the key and value | ||
* merging an existing array with any merged value, replaces the entire array with the value | ||
* merging a nonexistent object key adds the key and value | ||
* merging an existing array with any merged value replaces the entire array with the value | ||
</details> | ||
|
||
## Return value | ||
|
||
JSET.MERGE returns a simple string reply: `OK` if executed correctly or `error` if fails to set the new values | ||
JSET.MERGE returns a simple string reply: `OK` if executed correctly or `error` if fails to set the new values. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JSON.MERGE ;-) |
||
|
||
For more information about replies, see [Redis serialization protocol specification](/docs/reference/protocol-spec). | ||
|
||
## Examples | ||
|
||
The JSON.MERGE provide four different behaviours to merge changes on a given key: create unexistent path, update an existing path with a new value, delete a existing path or replace an array with a new array | ||
The JSON.MERGE command provides four different behaviors to merge changes on a given key: create a new path, update an existing path with a new value, delete a existing path or replace an array with a new array. | ||
|
||
<details open> | ||
<summary><b>Create a unexistent path-value</b></summary> | ||
<summary><b>Create a new path-value</b></summary> | ||
|
||
{{< highlight bash >}} | ||
redis> JSON.SET doc $ '{"a":2}' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what Nermina called "telegraphic writing style". She introduced this style in all module commands that she touched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange as it makes it sound like broken English also something being "key" in this sense means important. "is key to our understanding etc." Let's run without the "the" but this style is detrimental IMHO.