Skip to content

Querying content with null field #23

@ondrejfuhrer

Description

@ondrejfuhrer

Hello there,

We have a use case where we need to query the content by specifying one of the fields as null. So the use case would be that you have a content with optional field and distinguish between having it filled in with certain value or not filled at all.

Example:

ID field1 field2
1 value1
2 value1 value2

Q1: ?query={"field1": "value1", "field2": null} will return id 1
Q2: ?query={"field1": "value1", "field2":"value2"} will return id 2

I noticed that in the implementation you're currently using a JSONObject.put which in case I call query.put("field1", null) actually removed the key field1 from the object instead of adding it as a value.

Is there currently a workaround how to query values like that (except querying all models that fit it and check for the field manually)?

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