Setting a value whose path does not yet exist in the object (but its parent does exist) should work, but it doesn't if there is a [*] in the JSON path.
Description
valkey-server:6379> JSON.SET mydoc $ '{"list": [{}]}'
OK
valkey-server:6379> JSON.SET mydoc $.list[*].fruit '"apple"'
(error) Err wrong static path
This behavior is inconsistent with what happens when the path already exists, which works:
valkey-server:6379> JSON.SET mydoc $ '{"list": [{"fruit": "pear"}]}'
OK
valkey-server:6379> JSON.SET mydoc $.list[*].fruit '"apple"'
OK
It also works if the [*] is replaced with [0]:
valkey-server:6379> JSON.SET mydoc $ '{"list": [{}]}'
OK
valkey-server:6379> JSON.SET mydoc $.list[*].fruit '"apple"'
(error) Err wrong static path
Installation details
OS: Arch linux, Kernel
Redis version: Valkey 7.2 (from DockerHub)
Architecture: x86-64
RedisJSON version: 2.8.4
Reactions are currently unavailable
Setting a value whose path does not yet exist in the object (but its parent does exist) should work, but it doesn't if there is a [*] in the JSON path.
Description
valkey-server:6379> JSON.SET mydoc $ '{"list": [{}]}' OK valkey-server:6379> JSON.SET mydoc $.list[*].fruit '"apple"' (error) Err wrong static pathThis behavior is inconsistent with what happens when the path already exists, which works:
valkey-server:6379> JSON.SET mydoc $ '{"list": [{"fruit": "pear"}]}' OK valkey-server:6379> JSON.SET mydoc $.list[*].fruit '"apple"' OKIt also works if the [*] is replaced with [0]:
valkey-server:6379> JSON.SET mydoc $ '{"list": [{}]}' OK valkey-server:6379> JSON.SET mydoc $.list[*].fruit '"apple"' (error) Err wrong static pathInstallation details
OS: Arch linux, Kernel
Redis version: Valkey 7.2 (from DockerHub)
Architecture: x86-64
RedisJSON version: 2.8.4