# Connections

Connection fields allow you to paginate through one-to-many or many-to-many relationships as well as access any intermediate data. All connections have 3 root fields: `edges`, `nodes`, and `pageInfo`.

## Edges

Edges are the intermediate data between the parent and child nodes. They are the relational link between the two, containing data pertaining to *how* the two are related along with a reference to the child node.

### Example

To help understand how these connections work, we'll use the relationship between `Media` and `Character` as an example.

An anime can have many characters, and a character can appear in many anime. These characters have a specific role in the anime (Main, Support, or Background) and they can have multiple voice actors in a single anime.

Neither the role nor the list ofvoice actors make sense to be stored in the `Character` object, so that connecting data lives on the `CharacterEdge` object.

```graphql
{
  Media {
    characters(page: 1) {
      edges { # Array of character edges
        role
        voiceActors { # Array of voice actors of this character for the anime
          id
          name {
            first
            last
          }
        }
      }
    }
  }
}
```

## Nodes

Nodes are the actual child data of the connection. You can access them with the `node` field on the edge object.

::: tip If you do not need to access any of the intermediate data, you can use the `nodes` field instead of `edges`. :::


---

# Agent Instructions: 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:

```
GET https://anilist.gitbook.io/anilist-apiv2-docs/docs/guide/graphql/connections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
