Skip to content

Type coercion for numerical comparison #37

@joeworkman

Description

@joeworkman

If you want to store float values in JSON, you must store them as string. Therefore, to make my life easier, I simply store all numbers as strings in my JSON.

I have not had any issues with this until now. I cannot seem to use the numerical comparisons in the jsql.

Data:

[{"popularity":"100"}, {"popularity":"50"}, {"popularity":"75"}]
[{"price":"5.95"}, {"price":"99.95"}, {"price":"49.95"}]

JSQL:

{popularity: {gt: 50}}
{price: {gt: 50}}

Please let me know if I am missing something, I would not doubt that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions