Skip to content

Commit

Permalink
JSON: Fix arity of JSON.SET (#1849)
Browse files Browse the repository at this point in the history
Co-authored-by: Twice <twice.mliu@gmail.com>
  • Loading branch information
mapleFU and PragmaTwice authored Oct 22, 2023
1 parent af13343 commit 8b54200
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/cmd_json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class CommandJsonType : public Commander {
}
};

REDIS_REGISTER_COMMANDS(MakeCmdAttr<CommandJsonSet>("json.set", -3, "write", 1, 1, 1),
REDIS_REGISTER_COMMANDS(MakeCmdAttr<CommandJsonSet>("json.set", 4, "write", 1, 1, 1),
MakeCmdAttr<CommandJsonGet>("json.get", -2, "read-only", 1, 1, 1),
MakeCmdAttr<CommandJsonType>("json.type", -2, "read-only", 1, 1, 1),
MakeCmdAttr<CommandJsonArrAppend>("json.arrappend", -4, "write", 1, 1, 1), );
Expand Down
1 change: 1 addition & 0 deletions tests/gocase/unit/type/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestJson(t *testing.T) {
defer func() { require.NoError(t, rdb.Close()) }()

t.Run("JSON.SET and JSON.GET basics", func(t *testing.T) {
require.Error(t, rdb.Do(ctx, "JSON.SET", "a").Err())
require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", ` {"x":1, "y":2} `).Err())
require.Equal(t, rdb.Do(ctx, "JSON.GET", "a").Val(), `{"x":1,"y":2}`)

Expand Down

0 comments on commit 8b54200

Please sign in to comment.