> For the complete documentation index, see [llms.txt](https://docs.spydra.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spydra.app/developers/api-reference/custom-chaincode/graphql/complex-queries.md).

# 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

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

Response:

```json
{
    "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](/developers/api-reference/asset-tokenization/graphql/operators.md)

**Complex query – multiple conditions**

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

Response:

```json
{
    "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
            }
        ]
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.spydra.app/developers/api-reference/custom-chaincode/graphql/complex-queries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
