Search code examples
fiwarefiware-orion

FIWARE Orion string query and dates


I have a question regarding queries, I am working on FIWARE Orion instance where the date is stored as a string:

"date": {
        "type": "String",
        "value": "2019-01-02T00:00:00.0000Z",
        "metadata": {}
    }

I have checked documentation about queries (most interest in < >)

This operation is only valid for target properties of type date, number or string (used with target properties of other types may lead to unpredictable results).

But it is not possible for me to for example to use this query:

q=date<2020-04-13T00:00:00.0000Z
q=date<2020-04-13

My question is this possible if it is then what I am doing wrong here. If not then I will have to find an alternative way of getting this query to work.

Thanks.


Solution

  • I think the DateTime special attribute type (see "Special Attribute Types" at NGSIv2 specification) is the one you need.

    You can see additional information and examples in this presentation slides 64 and 65.