Skip to content

JSON.GET Nested path filter issue #1495

@mrdj07

Description

@mrdj07

I am having an issue with the way JSON.GET works with the following data:

gtfs_sample.json

This data is stored in a JSON field in Redis. Let's name this key alerts.

Based on the following query:

JSON.GET alerts '$.entity[?(@.alert.informed_entity[?(@.route_id == "1-11")])]'

I would expect to get a list of the following IDs:

196, 200, 202, 204, 184, 194, 192, 186

But I only get the following results:

200, 202, 194, 192.

Now based on these tests, it is clear to me that the returned results are the ones where the field "informed_entity" posess only one entry with the requested "route_id":

{ "id": "194", "alert": { "informed_entity": [ { "route_id": "1-11", "stop_id": "1-1766" } ] } }, { "id": "192", "alert": { "informed_entity": [ { "route_id": "1-11", "stop_id": "1-1764" } ] } },
Are both correctly returned by the command, but this is not:
{ "id": "186", "alert": { "informed_entity": [ { "route_id": "1-11", "stop_id": "1-1270" }, { "route_id": "1-11", "stop_id": "1-1762" }, { "route_id": "1-11", "stop_id": "1-1763" } ] } },

I have tried other syntaxes but with the same results:

$.entity[?(@.alert.informed_entity[?(@.route_id == "1-11")])]
$.entity[?(@.alert.informed_entity..route_id == "1-11")]
$.entity[?(@.alert.informed_entity[*].route_id == "1-11")]

I think my query is correct, and the Redis Implementation should return the correct results.

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