diff --git a/src/fragments/lib/graphqlapi/js/query-data.mdx b/src/fragments/lib/graphqlapi/js/query-data.mdx index a421fd6641a..c5f5fedeafd 100644 --- a/src/fragments/lib/graphqlapi/js/query-data.mdx +++ b/src/fragments/lib/graphqlapi/js/query-data.mdx @@ -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 @@ -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. @@ -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.