DEV: document JSONPath extensions - #3601
Conversation
|
Thank you, @cmilesb! |
| <details open> | ||
| <summary><b>Compute a value with a projection expression</b></summary> | ||
|
|
||
| Beginning with Redis Open Source 8.10, the path can be a projection expression that computes a value using arithmetic or a function, rather than only selecting a value from the document. For example: |
There was a problem hiding this comment.
I don't think there is anything special about projections. It is just one of the JSONPath syntax extensions we introduced in 8.10.
There is also nothing special about JSON.GET, JSON.MGET, and JSON.RESP in that regard. You can use these extensions with any command that accepts a JSONPath.
I'd remove it from these e commands.
| weight: 4 | ||
| --- | ||
|
|
||
| Beginning with Redis Open Source 8.10, the JSON data type extends its |
There was a problem hiding this comment.
We can say that in Redis 8.10 we extended our JSONPath supported syntax with the following:
- Projection expressions at the top level of a JSONPath query
==and!=can now compare any literal, including array and object literals- Filter negation operator:
! size/sizeofandemptyoperators on string, array, object, and nodelistinandninoperators: membership test on an array and nodelist- Operators on numbers: binary
-,+,*,/,%, and unary-and+ - Operator on object:
~ length()function on array, object, and string- Functions on number:
abs(),ceiling(),floor() - Functions on string:
match(),search() - Strings concatenation with
concat() - Functions on array:
first(),last(),index(),append() - Aggregation functions on array:
min(),max(),avg(),sum(),stddev() - Function on object:
keys() - Function on nodelist:
count() - Function on nodelist with exactly one node:
value() - Relations functions on array and nodelist:
subsetof(),anyof(),noneof()
| @@ -0,0 +1,423 @@ | |||
| --- | |||
There was a problem hiding this comment.
We don't need a new document.
Instead, we should reflect these extensions in https://redis.io/docs/latest/develop/data-types/json/path/
|
|
||
| Paths within the filter condition use the dot notation with either `@` to denote the current array element or the current object value, or `$` to denote the top-level element. For example, use `@.key_name` to refer to a nested value and `$.top_level_key_name` to refer to a top-level value. | ||
|
|
||
| Beginning with Redis Open Source 8.10, filter expressions and queries support additional operators, functions, and top-level projection expressions. For details, see [JSONPath extensions]({{< relref "develop/data-types/json/path-extensions" >}}). |
There was a problem hiding this comment.
Please include the extensions in this document rather than having a separate document.
We don't need to call them "extensions". We now support a richer syntax, more operators, and more functions.
|
Closing this pull request, because @LiorKogan wants all the new syntax on the existing JSONPath page and says we don't need the JSON command changes. |
This is a Redis 8.10 feature. The primary page to review is this one:
https://redis.io/docs/staging/DOC-6818/develop/data-types/json/path-extensions/
There is a new example on each of the command pages. The other changes are just page sorting changes.
Note
Low Risk
Documentation-only changes with no runtime or API code; low risk aside from ensuring 8.10 behavior and breaking-change notes stay accurate.
Overview
Documents Redis Open Source 8.10 JSONPath extensions: a new JSONPath extensions guide (
path-extensions.md) covering evaluation semantics, breaking changes (tilde in field names, reserved words), filter operators (!, literals, arithmetic,in/nin, set relations,size/empty,~), functions (length,keys, aggregations,append, etc.), and projection expressions limited toJSON.GET,JSON.MGET, andJSON.RESP.JSON.GET,JSON.MGET, andJSON.RESPeach gain an open example section for projection paths with links to the new page. The core Path page points readers to extensions for 8.10+ capabilities. JSON develop section weights are bumped (use_cases4→5 throughdeveloper7→8) to slot the new page at weight 4.Reviewed by Cursor Bugbot for commit d8ab0b1. Bugbot is set up for automated code reviews on this repo. Configure here.