Movatterモバイル変換


[0]ホーム

URL:


Dev guideRecipesAPI ReferenceChangelog
Dev guideRecipesUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog InCross-platform products
Dev guide
All
Pages
Start typing to search…

Parent and child queries

🚧

This feature is deprecated

The_children is deprecrated and will be replaced in favor of_link, seeJoins with Linking._children will continue to work throughout 2025.

When there is a parent-child relationship between GraphQL schemas, you can create a single query to retrieve parent documents and their children's documents using a special field in the projection called_children. With_children, you can formulate the child query with the child schema using arguments similar to regular GraphQL queries. 

Example:

The following example shows the parent query is used with theStartPage schema, and the child query is used with theBiographyPage schema.

{  StartPage(locale: en) {    total    items {      _children {        BiographyPage {          items {             Name          }        }      }      Name    }  }}

Response

{  "data": {    "StartPage": {      "total": 4,      "items": [        {          "_children": {            "BiographyPage": {              "items": [                {                  "Name": "Abraham Lincoln"                }              ]            }          },          "Name": "Start"        }      ]    }  },  "extensions": {    "requestId": "4b45a5b3-f905-4824-b903-5b9180376837",    "responseTime": 111  }}

The following example shows the parent query is used with theBloglistPageType schema, and the child query is used with theBlogitemPageType schema. So for every matching parent item in the blog list, the items for each parent are retrieved and shown in a single response. 

{  BloglistPageType(locale: en, where: {Title: {startsWith: "Optimizely"}}) {    items {      Name      Language      _children {        BlogitemPageType(where: {Created: {lt: "2019"}}) {          items {            Name          }        }      }    }  }}

Updated 2 months ago



[8]ページ先頭

©2009-2025 Movatter.jp