Skip to content

JSON.GET path syntax has an issue with filtering using an OR condition when encountering non-existent values #614

@arunura

Description

@arunura

name: JSON.GET path syntax has an issue with filtering using an OR condition when encountering non-existent values
description: The issue is specific to OR condition used in the JSONPath during JSON.GET
title: "[Bug]: JSON.GET issue with using OR in JSONPath"
labels: [bug, triage]
body:

  • type: markdown
    attributes:
    value: |
    Thanks for taking the time to fill out this bug report!

  • type: input
    id: operating_system
    attributes:
    label: OS
    description: Operating system and version (eg Ubuntu 20.04, OSX Catalina)
    placeholder: Linux 5.8.0-1041-aws

  • type: architecutre
    id: cpu_arch
    attributes:
    label: CPU Architecture
    description: CPU Architecture (eg: x86, x86-64, arm, etc).
    placeholder: x86_64

  • type: input
    id: redis_version
    attributes:
    label: Redis Server Version
    description: What version of redis-server are you running (redis-server --version)
    placeholder: 6.2.5

  • type: input
    id: redis_module_version
    attributes:
    label: Redis Module Version
    description: What version of this redis module was installed?
    placeholder: ReJson 20006

  • type: input
    id: was_redis_docker
    attributes:
    label: Docker Installation
    description: What version of this redis module was installed?
    placeholder: Yes

  • type: checkboxes
    id: installmethod
    attributes:
    label: Docker installation
    description: Check this box, if you installed the release via a docker.
    options:
    - label: I installed the dockerhub release

  • type: textarea
    id: whathappened
    label: What happened?
    description: Please tell us what happened, and what you expected to happen.
    placeholder: Tell us what you see!

  • type: textarea
    id: logs
    label: Relevant log output
    description: If release, please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
    render: shell

The output of the last two executions are incorrect due to the issue. The issue seems to happen when a value (eg: Paris) not present in the JSON object is used in the path query.

127.0.0.1:6379> JSON.set testList . "[{\"name\":\"Thomas\",\"city\":\"London\"},{\"name\":\"Arun\",\"city\":\"Glasgow\"},{\"name\":\"Peter\",\"city\":\"Glasgow\"}]"
OK
127.0.0.1:6379> JSON.get testList '$[?(@.city=="London" || @.city=="Glasgow")]'
"[{\"name\":\"Thomas\",\"city\":\"London\"},{\"name\":\"Arun\",\"city\":\"Glasgow\"},{\"name\":\"Peter\",\"city\":\"Glasgow\"}]"
127.0.0.1:6379> JSON.get testList '$[?(@.city=="London" || @.city=="Paris")]'
"[]"
127.0.0.1:6379> JSON.get testList '$[?(@.city=="London" || @.city=="Glasgow" || @.city=="Paris")]'
"[]"
127.0.0.1:6379> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions