diff --git a/src/commands/cmd_json.cc b/src/commands/cmd_json.cc index 2c0fb0c68e3..6b5445c7f03 100644 --- a/src/commands/cmd_json.cc +++ b/src/commands/cmd_json.cc @@ -148,7 +148,7 @@ class CommandJsonType : public Commander { } }; -REDIS_REGISTER_COMMANDS(MakeCmdAttr("json.set", -3, "write", 1, 1, 1), +REDIS_REGISTER_COMMANDS(MakeCmdAttr("json.set", 4, "write", 1, 1, 1), MakeCmdAttr("json.get", -2, "read-only", 1, 1, 1), MakeCmdAttr("json.type", -2, "read-only", 1, 1, 1), MakeCmdAttr("json.arrappend", -4, "write", 1, 1, 1), ); diff --git a/tests/gocase/unit/type/json/json_test.go b/tests/gocase/unit/type/json/json_test.go index b86e343fc4f..5a60ee0295d 100644 --- a/tests/gocase/unit/type/json/json_test.go +++ b/tests/gocase/unit/type/json/json_test.go @@ -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}`)