Skip to content

JSON.STRLEN behaviour doesn't match documentation, with defaults #504

Closed

Description

@chayim

Based on the documentation for JSON.STRLEN if the path isn't provided '.' is assumed. This is similar to what occurred in #502. If a key is not provided, a null should be returned:

path defaults to root if not provided. If the key or path do not exist, null is returned.

But, using our example below, when testing with a key that does not exist an error is raised, instead of None.

127.0.0.1:36379> json.strlen 'smirf'
(error) ERR wrong number of arguments for 'json.strlen' command
127.0.0.1:36379> json.arrlen 'strlen' .
(nil)
127.0.0.1:36379> json.arrlen 'strlen' 
(error) ERR wrong number of arguments for 'json.strlen' command
127.0.0.1:36379> 

In our second example - when setting a value, and attempting to run an strlen without specifying a path, the default path of '.' should be used. But as seen below, it was not.

127.0.0.1:36379> json.set foo . '[5,6,7,8,9]'
OK
127.0.0.1:36379> json.strlen foo
(error) ERR wrong number of arguments for 'json.strlen' command
127.0.0.1:36379> json.strlen foo .
(integer) 5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions