DiceDB / dice

DiceDB is a redis-compliant, in-memory, real-time, and reactive database optimized for modern hardware and for building and scaling truly real-time applications.
https://dicedb.io/
Other
6.65k stars 1.06k forks source link

fix:keep JSON.TYPE consistent with redis #388

Closed jujiale closed 2 months ago

jujiale commented 2 months ago

hello,in JSON.TYPE command. there is some inconsistency with redis JSON.TYPE In Redis JSON.TYPE, such as below: `

 127.0.0.1:6379> JSON.SET user $ '{"name":"tom","flag":true,"high":1.75,"age":23,"test":null,"language":["java","python","go"], "parter":{"name":"jerry","flag":true}}'
 127.0.0.1:6379> JSON.TYPE user
 "object"
 127.0.0.1:6379> JSON.TYPE user $
 1) "object"
 127.0.0.1:6379> JSON.TYPE user $.name
 1) "string"
 127.0.0.1:6379> JSON.TYPE user $.test
 1) "null"
 127.0.0.1:6379> JSON.TYPE user $.language
 1) "array"
 127.0.0.1:6379> JSON.TYPE user $.name
 1) "string"
 127.0.0.1:6379> JSON.TYPE user $..name
 1) "string"
 2) "string"
 127.0.0.1:6379> JSON.TYPE user $.aaa
 (empty array)

`

we could see. in reids. JSON.TYPE returns an array of string replies for each path. because the JSON.GET will sustain consistency with redis, so JSON.TYPE also need to do this.

jujiale commented 2 months ago

@JyotinderSingh hello,please review it. thanks