【问题标题】:wrong static path while adding new key value pair to an existing object向现有对象添加新的键值对时静态路径错误
【发布时间】:2023-02-02 21:45:39
【问题描述】:

我正在尝试向现有对象添加新的键值对,但没有成功。 该对象看起来像:

"weight": {
            "options": {
              
            },
            "value": 50
}

我的代码如下:

local optionId = 'a161713a-1987-4974-acfc-dd0a56ad99e7';
local weight = 20;
redis.call('JSON.SET', schemaKey, weightPath .. '.'..optionId, weight,'NX');

我得到了错误 wrong static path

【问题讨论】:

  • 什么是“weightPath”?请注意 jsonpath 应以 $ 符号开头。您尝试生成哪条路径?
  • @GuyKorland weightPath值为$.weight.options
  • 您使用的是哪个版本的 RedisJSON?

标签: redis lua redisjson


【解决方案1】:

虽然这可能已经晚了,但我怀疑你的路径中存在递归下降,这是一些双点,如 $..weight.options.aa 中的,目前 redis SET 不支持。 该主题在here 中讨论。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-02-22
    • 1970-01-01
    • 2022-11-02
    • 2019-11-01
    • 2022-06-29
    • 1970-01-01
    • 2022-12-17
    • 1970-01-01
    相关资源
    最近更新 更多