Skip to content

There were many extra ')' in this page #5004

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

Merged
merged 2 commits into from
Jan 30, 2023
Merged
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
8 changes: 4 additions & 4 deletions src/fragments/lib/graphqlapi/js/query-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ let filter = {
eq: 1 // filter priority = 1
}
};
await API.graphql({ query: listProducts, variables: { filter: filter}}));
await API.graphql({ query: listProducts, variables: { filter: filter}});
```

### Compound Filters
Expand All @@ -128,7 +128,7 @@ let filter = {
or: [{ priority: {eq:1} },
{ priority: {eq:2} }]
};
await API.graphql({ query: listProducts, variables: { filter: filter}}));
await API.graphql({ query: listProducts, variables: { filter: filter}});
```

Note that querying for `priority` of 1 AND 2 would return no results, because this is boolean logic instead of natural language.
Expand All @@ -139,11 +139,11 @@ Pagination in AppSync is done by making a request with a `limit`, and getting ba

```js
// page 1 of query
const { data: { listProducts: { items: itemsPage1, nextToken } } } = await API.graphql({ query: listProducts, variables: { limit: 20, /* add filter as needed */ }}));
const { data: { listProducts: { items: itemsPage1, nextToken } } } = await API.graphql({ query: listProducts, variables: { limit: 20, /* add filter as needed */ }});
// // You are assuming that `listProducts` includes a query for `nextToken`, which is the case for autogenerated GraphQL query strings.

// page 2 of query
const { data: { listProducts: { items: itemsPage2 } } } = await API.graphql({ query: listProducts, variables: { limit: 20, nextToken }}));
const { data: { listProducts: { items: itemsPage2 } } } = await API.graphql({ query: listProducts, variables: { limit: 20, nextToken }});
```

A `nextToken` is a very long string that looks like `"eyJ2ZXJzaW9uejE1a2RPanZPQzFCMlFTdGNxdUFBQUJxekNDQWFjR0NTcUdTSWIzRFFFSEJxQ0NBWmd3Z2dHVUFnRUFNSUlCalFZSktvWklodmNOQVFjQk1CNEdDV0NHU0FGbEF3UUJMakFSQkF5eEtWQjUvTlJxS2o5ZHBYc0NBUkNBZ2dGZUZFNW1MbTRkb25BOUg0U0FpOGhSZ1lucmRndmQz"` which represents the cursor to the starting item of the next query made with these filters.
Expand Down