# How to display more than 100 documents with graphql?

**URL:** <https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228>\
**Category:** Developing with Prismic\
**Tags:** graphql\
**Created:** [September 27, 2021, 9:03am UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228 "2021-09-27T09:03:01Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![baptiste](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/baptiste/32/1149_2.png) [@baptiste](https://community.prismic.io/u/baptiste)\
**Post date:** [September 27, 2021, 9:03am UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/1 "2021-09-27T09:03:01Z")

</div>

Hi, in my project i have more than 100 documents per Custom Types to display, but the problem is that prismic graphql only return a maximum of 100 documents and the rest canot be fetch.

I see this documentation who explain how to paginate the results : [https://prismic.io/docs/technologies/paginate-your-results-graphql](https://prismic.io/docs/technologies/paginate-your-results-graphql) but this way requires to duplicate the query and put a cursor id manually. What does not very flexible for a big project...

I currently use the old plugin gatsby-source-prismic-graphql but I haven't seen anything about the new gatsby-source-prismic plugin either.

Is there a way to automatize the pagination ? Or make a loop in a graphql query ? Is this possible with the new plugin gatsby-source-prismic ?

Thank you for your help !

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [September 28, 2021, 2:09am UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/3 "2021-09-28T02:09:31Z")

</div>

Hello @baptiste, thanks for reaching out.

With the `gatsby-source-prismic-graphql` plugin you can only return 20 documents per request. This is because the plugin is based on Prismic’s GraphQL API. In that case, the documentation you need to read is the following:

> **[Paginate your results with the Prismic GraphQL API](https://prismic.io/docs/technologies/paginate-your-results-graphql)**
>
> This page describes how to paginate your results with the cursor-based pagination used by the Prismic GraphQL API.

The `gatsby-source-prismic` plugin, on the other hand, fetches the data using REST API. It does not have the limitation that GraphQL has. Here is the documentation to create pagination with Gatsby and this plugin:

> **[Pagination with Gatsby](https://prismic.io/docs/technologies/paginate-results-gatsby)**
>
> Learn how to implement pagination in your Gatsby project.

If you need it, [we have a dedicated guide to migrate from one plugin to the other one.](https://prismic.io/docs/technologies/migrate-to-gatsby-source-prismic-gatsby)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [October 4, 2021, 4:08pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/4 "2021-10-04T16:08:02Z")

</div>

closed on October 4, 2021, 4:08pm UTC as resolved,  flag & select 'Something Else' to reopen.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 3:24pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/5 "2021-12-09T15:24:47Z")

</div>

Opened on December 9, 2021, 3:24pm UTC



---

<div class="post-metadata">

**Author:** ![pete1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pete1/32/3014_2.png) [@pete1](https://community.prismic.io/u/pete1)\
**Post date:** [January 7, 2022, 1:20pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/6 "2022-01-07T13:20:57Z")

</div>

Hello, I’m seeing a similar issue to the original question (I’m not using Gatsby but the question is actually related to the graphQL API).

Obviously, switching to use the REST API fixed the issue for @baptiste but the question ‘How to display more than 100 documents with graphQL?’ is still unresolved.

When doing a graphQL query for multiple documents that should return \> 100 results, the `totalCount` field is always limited to 100.

I’m aware of the max 20 documents limit and how to use cursors and pagination to retrieve all the results. But the problem is that there is this mystery limit of 100 that isn’t documented anywhere. The closest mention I can find is for the [`@prismicio/client`](https://prismic.io/docs/technical-reference/prismicio-client#query-methods) that talks about a ‘default and maximum page size is 100 documents’ for standard get methods like `getByIds` but that get-all methods like `getAllByIDs` can be used to avoid this limit.

I’m using `ids_in` to retrieve all matching documents of a custom type. Is there a similar method to `getAllByIds` available for the graphQL API or a way to increase the limit above 100?

Our repo is [metier.prismic.io](http://metier.prismic.io) and this is a reduced test case query:

```auto
query ProductCard($ids: [String!]) { 
  allProducts(id_in: $ids) {
    totalCount
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    edges {
      node {
        title
      }
    }
  }
}

```

When this array of 157 valid document ids is passed in it always returns a `totalCount` of exactly 100.

```auto
{
  "ids": ["X6CGThAAACAApYU9","YT--lhEAACAAoT_h","X6CIdBAAACAApY7l","X6CI5hAAAB4ApZDw","X6CIBhAAACIApYzy","X6CGsxAAACAApYcA","X6CC7xAAACIApXYp","YT_A-BEAACAAoUqj","X6CENRAAACAApXvV","X6CD6xAAAB4ApXqN","YbsNYBIAACIAHhST","YZzFPBAAACEAkrSJ","X6BOoxAAACEApIlT","YFxrThIAACIAhXc4","YKpe3hEAACIAiwND","YZrUiBAAACEAigNB","YFxodxIAACIAhWpV","YZzGmBAAACEAkrrS","YFxjHBIAACIAhVJR","YFxnexIAACEAhWXU","X6CiLxAAACAApgNR","X6CiyhAAACAApgYb","X6Ci-RAAACIApgby","X6CiYRAAACEApgQz","X6Ch_hAAACIApgJ1","X6ChrBAAACIApgD_","X6ChMhAAACEApf7X","YZzEgxAAACQAkrEz","X6CMKxAAACIApZ-3","X6CMrxAAACIApaIX","YbsO1BIAACAAHhcW","X37wsRUAACgAkfc3","X6CNKRAAACAApaQ9","YT_CvREAAERtoVKG","X37wfxUAACkAkfZD","X6CQbhAAACAApbKD","X37tcxUAACkAkegn","X37vSxUAACkAkfCy","YGSHkhIAACIAp9q8","YZ52NhAAACQAqRwU","X6CRHRAAACAApbWo","X6CRXBAAACAApbbM","X6CSWxAAACIApbtM","X6CSrhAAACAApbzK","X6CS9hAAACEApb4R","YZ5-FhAAACEAqUA0","X6CV3RAAACAApcso","X6CWIxAAACEApcxn","X6CWyBAAACIApc9b","YAYfMxAAACUAQ0h2","X6CkpRAAACEApg6D","X6CjyRAAACEApgqa","X6Ck2hAAACAApg9x","YF3nLBIAACEAi_3w","X6ClPxAAAB4AphEB","YOTtwxIAAGkettny","YT_HgREAACAAoWe3","YOTouRIAACIAtsOV","X6FJDBAAAB4AqPsh","X0_MhRAAAGYIRNMN","X6Cc0hAAACAApese","X6CbahAAACAApeSm","X6CbJxAAACEApeNp","X6CfJxAAAB4ApfWN","X6CfdxAAACEApfb0","X19rixEAACMAd86Y","X6Ce3BAAACAApfRD","X9C-8xYAACoA2pzZ","X9DEmxYAACoA2raF","YZ2JXhAAACIAlgDI","YZ4fwxAAACIAmJ9F","YZ4gtRAAACIAmKOV","YZ4iZhAAACQAmKsm","YG9WJBMAACIAi2k5","YJ8TIBAAACEA_h9G","YG9VNRMAACAAi2Ts","YG9UWxMAACIAi2D7","YG9XKxMAACMAi24T","YG9WtBMAACAAi2vd","X6HsjhAAACEAq-QK","X6HrrxAAAB4Aq-Am","X6HsPRAAACAAq-Ki","X6HquRAAACAAq9vO","YG9q8BMAACEAi8ig","YG9psRMAACMAi8KK","YG9qPxMAACMAi8V6","YG9o6xMAACIAi75r","YG9nWBMAACMAi7dL","YG9oaxMAACIAi7wg","YG9J-hMAACAAizEi","X6KnJxAAACIAry0i","X6KmyxAAACEAryt4","YYB0GhEAAB8ARGjI","X6PnfRMAACIA4PY9","X6PnNRMAACMA4PT0","YZ4MPRAAACMAmElD","YZ4PTRAAACIAmFTR","X6PpcRMAACQA4P9l","YZ4IVxAAACEAmDc-","X6PqcBMAACQA4QQb","X6Pp8RMAACMA4QHD","X6PqNRMAACIA4QMF","YZ4y-xAAACIAmPdI","YZ4zaRAAACIAmPlL","X6PoNxMAACMA4Pmr","X6Pn_RMAACEA4PiX","YZvYkxAAACMAjpD2","YZvZOhAAACIAjpP6","X6HnkRAAAB4Aq811","X6HichAAACIAq7Y_","X6HjVhAAACEAq7pJ","X6HfmRAAACEAq6m-","X6Hf2xAAAB4Aq6ro","X6HjphAAACIAq7u2","X6HmYRAAACIAq8gk","X6HmKRAAACAAq8ce","YVZLVxEAACIAZ6BP","X6Hb_BAAACIAq5l9","YZrlNRAAACEAikzI","YZrglRAAACMAijgs","YZrd5BAAACEAiiw3","YZrfuRAAACMAijRe","YZrhJBAAACQAijqp","YN2lkhAAACIALJ4x","YN2m3RAAACEALKGt","YWA1rhAAACUAie8r","YWA2aRAAACMAifJw","YWA1CxAAACMAiexV","YWA0ZRAAACUAiel3","YWAzexAAACUAieVY","YWAyrRAAACQAieHj","X9Va7BYAACsA7sCN","X6KbQhAAACIArveG","YNx_MhIAACEAya7G","X6KezhAAACEArwgO","X6KfpxAAAB4Arwv4","X6KZ_BAAAB4ArvFl","YNuNXRIAAI8SxYW-","YN2bCBAAACIALHg7","YN2dQxAAACAALIIH","X6Kd0xAAAB4ArwOF","X6KemxAAAB4Arwce","X6KfWxAAACIArwqd","X6KNYxAAACEArrUk","X9VgFhYAACoA7tdn","X9VfUBYAACoA7tP3","X_GxnxAAAMJH6tWg","X_GwaxAAACUA6tA9","YP7_8xAAACMApIeC","YN21exAAACAALNPo","X_GtsBAAACUA6sQZ","YZ2BZBAAACQAldzy","X6KozhAAACAArzTG","X6KpmxAAACIArzh6","X6KpBRAAACIArzW_","X6KpOBAAACAArzan","X6KpbBAAAB4ArzeV"]
}

```

As @baptiste mentioned, we could run multiple queries 100 items at a time using a manual cursor id but that seems inflexible for a big project.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [January 11, 2022, 9:14pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/8 "2022-01-11T21:14:12Z")

</div>

Hey there!

I had a chat with the development team. Now it's possible to retrieve a maximum of 100 documents per request. We've just updated the documentation to reflect this change.

Here's how the same query would look like:

```auto
query ProductCard($ids: [String!]) { 
  allProducts(id_in: $ids, first: 100) {
    totalCount
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    edges {
      node {
        title
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![pete1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pete1/32/3014_2.png) [@pete1](https://community.prismic.io/u/pete1)\
**Post date:** [January 12, 2022, 10:00am UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/9 "2022-01-12T10:00:03Z")

</div>

Thanks, @Pau, that’s very useful to know that we can now retrieve up to 100 documents per request.

I’m still confused about the limit of 100 being applied to the overall query, though. This isn’t to do with pagination limits but an invisible limit being applied to the overall number of documents matched by the query.

The array that I’m passing to the query includes 157 unique and valid document ids but you can see that the `totalCount` being returned is 100.

If you delete some ids from the beginning of the array and then run the query then it still returns a `totalCount` of 100.

Unfortunately, this means that I can’t paginate to get the rest as `hasNextPage` is `false` because the response “thinks” it has returned all the results when I know there are still more that should be returned.

If you run the query without the `id_in` filter to retrieve all documents then it returns a `totalCount` of 471 so I know that in theory it should be possible to match over 100 documents in a query. It’s only when using `id_in` to filter the results that this invisible limit kicks in.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [January 13, 2022, 1:42am UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/10 "2022-01-13T01:42:25Z")

</div>

I'll raise this question to the relevant team. We'll get back to you as soon as we have an answer.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [January 13, 2022, 5:33pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/13 "2022-01-13T17:33:15Z")

</div>

Ok so, the solution is pagination. As explained in this section of the same doc. Use the `after` argument to be able to get the documents that come after the given `first` number:

> **[Paginate your results with the Prismic GraphQL API](https://prismic.io/docs/technologies/paginate-your-results-graphql#the-after--first-arguments)**
>
> This page describes how to paginate your results with the cursor-based pagination used by the Prismic GraphQL API.

The team created a sample project to exemplify pagination. You can check it out here:

> **[Example projects with GraphQL](https://prismic.io/docs/technologies/example-projects-with-graphql)**
>
> This page showcases the example projects available to learn how to use Prismic with GraphQL.

---

<div class="post-metadata">

**Author:** ![pete1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pete1/32/3014_2.png) [@pete1](https://community.prismic.io/u/pete1)\
**Post date:** [January 14, 2022, 12:18pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/14 "2022-01-14T12:18:03Z")

</div>

Hi Pau,

I’ve already got pagination set up and working, that’s not the issue here.

There’s a limit somewhere on Prismic’s side that’s causing the query to return incomplete results. It’s not in the documentation and it breaks the pagination example you shared so I can only assume it’s a bug.

Pagination in Prismic uses `hasNextPage` to decide whether there are still more documents to fetch. This code snippet is taken from **AllPostsLoader.js** in the _react-graphql-pagination-example_ project.

 ![Screenshot 2022-01-14 at 11.21.28](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/8/8d153f01afddc6cbda95c0f4a618bd75bb5741ad.png)

But after retrieving the first 100 documents from my query `hasNextPage` is `false` meaning the script won’t trigger another query.

I’ve tried querying the first 99 results, taking the `endCursor` from that result and passing it in as the `after` variable for the next query and it only returns 1 document. So `totalCount` returns `100` and `hasNextPage` is `false` after retrieving 100 documents.

It’s clear that only 100 documents are being returned and I can’t retrieve any more using pagination.

**Please** could you test using the info I’ve provided for our repo ([metier.prisimic.io](http://metier.prisimic.io))? It’s easy to spot it happening in the graphQL explorer with these steps.

1. Run the query and you’ll see `totalCount` is `100` and `hasNextPage` is `false`.
2. Delete several ids from the variables array and rerun the query: you’ll see `totalCount` is still `100` and `hasNextPage` is `false`.

So that means that valid document ids after the first 100 are being ignored. The first query should have returned `totalCount` = `157` and `hasNextPage` = `true` meaning I could use pagination to retrieve the remaining documents.

Either there’s a limit on the size of variable array that can be submitted or there’s a limit being imposed on the documents that are returned.

```auto
query ProductCard($ids: [String!]) { 
  allProducts(id_in: $ids, first: 100) {
    totalCount
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    edges {
      node {
        title
      }
    }
  }
}

```

```auto
{
  "ids": ["X6CGThAAACAApYU9","YT--lhEAACAAoT_h","X6CIdBAAACAApY7l","X6CI5hAAAB4ApZDw","X6CIBhAAACIApYzy","X6CGsxAAACAApYcA","X6CC7xAAACIApXYp","YT_A-BEAACAAoUqj","X6CENRAAACAApXvV","X6CD6xAAAB4ApXqN","YbsNYBIAACIAHhST","YZzFPBAAACEAkrSJ","X6BOoxAAACEApIlT","YFxrThIAACIAhXc4","YKpe3hEAACIAiwND","YZrUiBAAACEAigNB","YFxodxIAACIAhWpV","YZzGmBAAACEAkrrS","YFxjHBIAACIAhVJR","YFxnexIAACEAhWXU","X6CiLxAAACAApgNR","X6CiyhAAACAApgYb","X6Ci-RAAACIApgby","X6CiYRAAACEApgQz","X6Ch_hAAACIApgJ1","X6ChrBAAACIApgD_","X6ChMhAAACEApf7X","YZzEgxAAACQAkrEz","X6CMKxAAACIApZ-3","X6CMrxAAACIApaIX","YbsO1BIAACAAHhcW","X37wsRUAACgAkfc3","X6CNKRAAACAApaQ9","YT_CvREAAERtoVKG","X37wfxUAACkAkfZD","X6CQbhAAACAApbKD","X37tcxUAACkAkegn","X37vSxUAACkAkfCy","YGSHkhIAACIAp9q8","YZ52NhAAACQAqRwU","X6CRHRAAACAApbWo","X6CRXBAAACAApbbM","X6CSWxAAACIApbtM","X6CSrhAAACAApbzK","X6CS9hAAACEApb4R","YZ5-FhAAACEAqUA0","X6CV3RAAACAApcso","X6CWIxAAACEApcxn","X6CWyBAAACIApc9b","YAYfMxAAACUAQ0h2","X6CkpRAAACEApg6D","X6CjyRAAACEApgqa","X6Ck2hAAACAApg9x","YF3nLBIAACEAi_3w","X6ClPxAAAB4AphEB","YOTtwxIAAGkettny","YT_HgREAACAAoWe3","YOTouRIAACIAtsOV","X6FJDBAAAB4AqPsh","X0_MhRAAAGYIRNMN","X6Cc0hAAACAApese","X6CbahAAACAApeSm","X6CbJxAAACEApeNp","X6CfJxAAAB4ApfWN","X6CfdxAAACEApfb0","X19rixEAACMAd86Y","X6Ce3BAAACAApfRD","X9C-8xYAACoA2pzZ","X9DEmxYAACoA2raF","YZ2JXhAAACIAlgDI","YZ4fwxAAACIAmJ9F","YZ4gtRAAACIAmKOV","YZ4iZhAAACQAmKsm","YG9WJBMAACIAi2k5","YJ8TIBAAACEA_h9G","YG9VNRMAACAAi2Ts","YG9UWxMAACIAi2D7","YG9XKxMAACMAi24T","YG9WtBMAACAAi2vd","X6HsjhAAACEAq-QK","X6HrrxAAAB4Aq-Am","X6HsPRAAACAAq-Ki","X6HquRAAACAAq9vO","YG9q8BMAACEAi8ig","YG9psRMAACMAi8KK","YG9qPxMAACMAi8V6","YG9o6xMAACIAi75r","YG9nWBMAACMAi7dL","YG9oaxMAACIAi7wg","YG9J-hMAACAAizEi","X6KnJxAAACIAry0i","X6KmyxAAACEAryt4","YYB0GhEAAB8ARGjI","X6PnfRMAACIA4PY9","X6PnNRMAACMA4PT0","YZ4MPRAAACMAmElD","YZ4PTRAAACIAmFTR","X6PpcRMAACQA4P9l","YZ4IVxAAACEAmDc-","X6PqcBMAACQA4QQb","X6Pp8RMAACMA4QHD","X6PqNRMAACIA4QMF","YZ4y-xAAACIAmPdI","YZ4zaRAAACIAmPlL","X6PoNxMAACMA4Pmr","X6Pn_RMAACEA4PiX","YZvYkxAAACMAjpD2","YZvZOhAAACIAjpP6","X6HnkRAAAB4Aq811","X6HichAAACIAq7Y_","X6HjVhAAACEAq7pJ","X6HfmRAAACEAq6m-","X6Hf2xAAAB4Aq6ro","X6HjphAAACIAq7u2","X6HmYRAAACIAq8gk","X6HmKRAAACAAq8ce","YVZLVxEAACIAZ6BP","X6Hb_BAAACIAq5l9","YZrlNRAAACEAikzI","YZrglRAAACMAijgs","YZrd5BAAACEAiiw3","YZrfuRAAACMAijRe","YZrhJBAAACQAijqp","YN2lkhAAACIALJ4x","YN2m3RAAACEALKGt","YWA1rhAAACUAie8r","YWA2aRAAACMAifJw","YWA1CxAAACMAiexV","YWA0ZRAAACUAiel3","YWAzexAAACUAieVY","YWAyrRAAACQAieHj","X9Va7BYAACsA7sCN","X6KbQhAAACIArveG","YNx_MhIAACEAya7G","X6KezhAAACEArwgO","X6KfpxAAAB4Arwv4","X6KZ_BAAAB4ArvFl","YNuNXRIAAI8SxYW-","YN2bCBAAACIALHg7","YN2dQxAAACAALIIH","X6Kd0xAAAB4ArwOF","X6KemxAAAB4Arwce","X6KfWxAAACIArwqd","X6KNYxAAACEArrUk","X9VgFhYAACoA7tdn","X9VfUBYAACoA7tP3","X_GxnxAAAMJH6tWg","X_GwaxAAACUA6tA9","YP7_8xAAACMApIeC","YN21exAAACAALNPo","X_GtsBAAACUA6sQZ","YZ2BZBAAACQAldzy","X6KozhAAACAArzTG","X6KpmxAAACIArzh6","X6KpBRAAACIArzW_","X6KpOBAAACAArzan","X6KpbBAAAB4ArzeV"]
}

```

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [January 20, 2022, 12:13am UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/16 "2022-01-20T00:13:21Z")

</div>

Hello @pete1, we're reviewing your use case with the dev team. We'll get back to you shortly.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [January 20, 2022, 4:03pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/17 "2022-01-20T16:03:11Z")

</div>

Hello @pete1 we've sent you a dm asking for your project details. Let us know if you got it.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [January 20, 2022, 5:52pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/18 "2022-01-20T17:52:11Z")

</div>

Ok so, in your query you'll need to send an ID `after` that will find where to locate the cursor. Only then the query will know where to look for the next pages:

```auto
query ProductCard{
  allProducts(after: "X6HsjhAAACEAq-QK" , first: 100) {
    totalCount
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    edges {
      node {
        title
        _meta {
          id
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![pete1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pete1/32/3014_2.png) [@pete1](https://community.prismic.io/u/pete1)\
**Post date:** [January 21, 2022, 10:08am UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/19 "2022-01-21T10:08:33Z")

</div>

I’ve explained several times that I know how to use pagination and already have it set up correctly but every answer so far has just been telling me how to use pagination rather than addressing my point!

The example you shared does indeed work using `after`. But it’s querying `allProducts` without the `id_in` filter and so returns every single product, which is not what I need.

 ![Screenshot 2022-01-21 at 09.50.39](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/c/cde8e5c2aa70fbe4bf9aafc18a3f58d1dc1129e9.jpeg)

I explained previously that I’ve tried this and it works as expected when the `id_in` is not used.

> [@pete1](#):
>
> If you run the query without the `id_in` filter to retrieve all documents then it returns a `totalCount` of 471 so I know that in theory it should be possible to match over 100 documents in a query. It’s only when using `id_in` to filter the results that this invisible limit kicks in.

Please try the following in our repo’s graph_i_QL editor using the info I’ve already shared to see what I mean:

1. Run initial query with no `after` and copy the `endCursor`. _Note that `totalCount` is `100` and `hasNextPage` is `false`._  

2. Run the query again with the `endCursor` passed in as the `after` variable. You’ll see there are no results even though more than 100 valid ids were passed in to the query.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [January 21, 2022, 7:39pm UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/20 "2022-01-21T19:39:28Z")

</div>

@pete1 I got some more info that can be helpful.  
I was able to replicate the error with the `id_in` operator. It's true that the cursors aren't working along with it. So the pagination won't work. But what you can do instead is to paginate using your `ids` by batches of 100. Here's an example of how to do it:

```auto
// Do a function that crawls the GraphQL endpoint by batching ids in id_in

const queryAll = async (ids) => {
  // Copy the ids array
  const bucketOfIds = [...ids]; // Length 157 in your case

  const results = [];

  // While we have ids in our bucket
  while (bucketOfIds.length) {

    // Get the first 100 of them
    const batchOfIds = bucketOfIds.splice(0, 100);

    // Query the batch from GraphQL and add the results to our results array
    results.push(...await runGraphQLQuery());

    // Log for demo purpose
    console.log(batchOfIds);
  }

  // Returns everything we got from GraphQL
  return results;
};

```

Let us know if this is helpful.  
I reported the issue to our product team.

---

<div class="post-metadata">

**Author:** ![pete1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pete1/32/3014_2.png) [@pete1](https://community.prismic.io/u/pete1)\
**Post date:** [January 24, 2022, 9:55am UTC](https://community.prismic.io/t/how-to-display-more-than-100-documents-with-graphql/7228/21 "2022-01-24T09:55:01Z")

</div>

Great, thanks for confirming and suggesting a way around the limit. I’ll try splitting the ids up into batches as suggested.
