Complex queries

Use the "where" argument to construct complex queries that has multiple conditions and nesting levels. For e.g. to query all assets with size greater than 5

query {
    document (size: {_gt: 5}) {
            assetID,
            color
            appraisedValue
            size
        }
}

Response:

{
    "data": {
        "document_count": 2,
        "document": [
            {
                "appraisedValue": 200,
                "assetID": "asset3",
                "color": "green",
                "size": 10
            },
            {
                "appraisedValue": 200,
                "assetID": "asset4",
                "color": "yellow",
                "size": 10
            }
        ]
    }
}

The query can include multiple conditions and include conditions on nested object fields too. For a complete list of supported operators, refer to Operator

Complex query – multiple conditions

query {
    document (_or: [
                {size: {_gt: 10}},
                {color: {_eq: "blue"}}
            ]) {
            assetID,
            color
            appraisedValue
            size
        }
}

Response:

{
    "data": {
        "document_count": 3,
        "document": [
            {
                "appraisedValue": 100,
                "assetID": "asset1",
                "color": "blue",
                "size": 5
            },
            {
                "appraisedValue": 250,
                "assetID": "asset5",
                "color": "black",
                "size": 15
            },
            {
                "appraisedValue": 250,
                "assetID": "asset6",
                "color": "white",
                "size": 15
            }
        ]
    }
}

Last updated