Cloudflare 中文文档
Analytics
Analytics
编辑这个页面
跳转官方原文档
Set theme to dark (⇧+D)

Nested Structures

Two kinds of nested structures that are supported: arrays and maps. Fields of either of these types are arrays; when they are part part of query result, which is already an array of objects, they become nested arrays.

​​ Arrays

The GraphQL API supports two different sorts of arrays:

  • Some arrays contain scalar types (for example, [String]) and function like ordinary fields that can be filtered
  • Some arrays contain more complex types (for example, [Subrequest].) The following section describes their behaviour.

Arrays of non-scalar types behave as a single value. There is no way to paginate through, filter, filter by, group, or group by the array.

On the other hand, you can choose which fields of the underlying type you want fetched.

For example, given arrays like this:

You can run a query to get the status by subrequest:

The results would be:

​​ Maps

Maps behave like arrays, but can be grouped using the sum function. They are used in aggregated datasets, such as httpRequest1dGroups.

Example maps:

Query:

Response:

​​ Examples

Query array fields in raw datasets:

Example response:

Query maps fields in aggregated datasets:

Example response: