Skip to content
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

JSON.ARRTRIM semantics is reversed #844

Closed
ashotland opened this issue Feb 21, 2023 · 0 comments · Fixed by #864
Closed

JSON.ARRTRIM semantics is reversed #844

ashotland opened this issue Feb 21, 2023 · 0 comments · Fixed by #864
Labels
bug Something isn't working docs-fixit

Comments

@ashotland
Copy link
Contributor

Describe the bug
JSON.ARRTRIM semantics is reversed
It trims the specified range instead of "rim an array so that it contains only the specified inclusive range of elements" (from redis docs)

To Reproduce
127.0.0.1:6379> JSON.SET key $ "[1, 2, 3, 4, 5, 6, 7]"
OK
127.0.0.1:6379> JSON.GET key
"[1,2,3,4,5,6,7]"
127.0.0.1:6379> JSON.ARRLEN key $

  1. (integer) 7
    127.0.0.1:6379> JSON.ARRTRIM key $ 2 3
    EXPECTED:
  2. (integer) 2
    GOT:
  3. (integer) 6
    127.0.0.1:6379> JSON.GET key
    EXPECTED:
    "[3, 4]"
    GOT:
    "[1,2,4,5,6,7]"
@ashotland ashotland added bug Something isn't working docs-fixit labels Feb 21, 2023
iko1 added a commit to iko1/dragonfly that referenced this issue Feb 21, 2023
romange pushed a commit that referenced this issue Feb 24, 2023
fix(server): fix json.arrtrim implementation (#844)

Signed-off-by: iko1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docs-fixit
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant