Solutons Lounge

mongodb – How to get paged and filtered entries using query state with Dapr?


I have a question regarding a small problem I am facing. In my POC, I am validating the exposure of an endpoint to return a filtered and paginated list of some data stored in the state store. I am using the state store query v1.0-alpha API directly (I could not find it in the PHP SDK).

When I need a slightly more complex filtering, I am receiving an error from the API.

http://localhost:40311/v1.0-alpha1/state/todo-statestore/query

{
    "sort": [{"key": "status"}],
    "page": {"limit": 10},
    "filter": {
        "OR": [
            {"EQ": {"todo": "my"}},
            {"EQ": {"status": "new"}},
            {"AND": [
                {"GTE": {"timestamp": 1644812400}},
                {"LTE": {"timestamp": 1644898800}}
            ]}
        ]
    }
}
{
    "errorCode": "ERR_STATE_QUERY",
    "message": "failed query in state store todo-statestore: failed to parse JSON query body: unsupported filter \"GTE\""
}

When I replace GTE with EQ, it works, but the operation is not what I need. The same happens with LTE. I got both GTE and LTE parameters from the documentation: https://docs.dapr.io/developing-applications/building-blocks/state-management/howto-state-query-api/#filter

CLI version: 1.12.0
Runtime version: 1.12.4

Has anyone experienced this problem or resolved the issue of data range filtering in some other way?



Source link

Exit mobile version