Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docusaurus/docs/cms/api/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ The following example fetches data for the `label` attribute of a "Closingperiod

### Fetch draft or published versions {#status}

If the [Draft & Publish](/cms/features/draft-and-publish) feature is enabled for the content-type, you can add a `status` parameter to queries to fetch draft or published versions of documents <DocumentDefinition/>:
You can add a `status` parameter to queries to fetch draft or published versions of documents <DocumentDefinition/>:

```graphql title="Example: Fetch draft versions of documents"
query Query($status: PublicationStatus) {
Expand All @@ -425,6 +425,10 @@ query Query($status: PublicationStatus) {
}
```

:::note
The `status` and `hasPublishedVersion` arguments appear in the GraphQL schema for all content types, including those without [Draft & Publish](/cms/features/draft-and-publish) enabled. This is because nested relations to D&P-enabled content types inherit these arguments from the root query. For example, querying a `User` type (which does not use Draft & Publish) with `status: PUBLISHED` ensures that any populated relation to a Draft & Publish-enabled type like `Article` returns the published version.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we haven't already documented hasPublishedVersion anywhere, we're going to immediately deprecate it for something different in the next few weeks, so I wouldn't publish this. Sorry for the confusion!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, of course, makes sense! I was so focused on status that I overlooked this part 🤦‍♂️
I'll close the PR, then

:::

## Aggregations

Aggregations can be used to compute metrics such as counts, sums, or grouped totals without fetching every document individually. Aggregations are exposed through <ExternalLink to="https://www.apollographql.com/docs/technotes/TN0029-relay-style-connections/" text="Relay-style"/> connection queries: every collection type includes an `aggregate` field under its `<plural>_connection` query.
Expand Down
Loading