Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reverse references example #2475

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
35 changes: 33 additions & 2 deletions content/docs/graphql/queries/get-document.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,37 @@ Query on post and author.
}"
/>

Query post on author.

<GraphQLCodeBlock
query="{
##author(relativePath:#&#x22;napolean.json&#x22;)#{
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
##author(relativePath:#&#x22;napolean.json&#x22;)#{
##author(relativePath:#&#x22;napoleon.json&#x22;)#{

Is always spelling Napoleon incorrectly in the docs/templates intentional?

####name
####post#{
######edges#{
########node#{
##########title
########}
######}
####}
##}
}"
response="{
##&#x22;data&#x22;:#{
####&#x22;author&#x22;:#{
######&#x22;name&#x22;:#&#x22;Napolean&#x22;,
######&#x22;post&#x22;:#{
########&#x22;edges&#x22;:#[
##########&#x22;node&#x22;:#{
############&#x22;title&#x22;:#&#x22;Vote for Pedro&#x22;,
##########}
########]
######}
####}
##}
}"
/>

## Common fields

In a collection, there are a few fields that are common to all documents. These are: `id`, `_values` and `_sys`. The `id` field is a unique identifier for the document. The `_values` field is used internally in edit mode and is not for external use. The `_sys` field contains meta information about the document.
Expand All @@ -75,7 +106,7 @@ The `_sys` field is an object with the following fields:
* `template`: The template of the document (or the name of the collection if not using `templates`)
* `collection`: Information about the collection

### Example with a nester folder
### Example with a nested folder

<GraphQLCodeBlock
query="{
Expand Down Expand Up @@ -113,7 +144,7 @@ The `_sys` field is an object with the following fields:
}"
/>

### Example without a nester folder
### Example without a nested folder

<GraphQLCodeBlock
query="{
Expand Down