_allDocuments equivalent from gatsby-source-prismic-graphql to gatsby-source-prismic: ^5.2.9

Hi,
I would like some help please on a project that I am working on. This one hasn't been updated for the past 4 years. I' am migrating from gatsby-source-prismic-graphql to gatsby-source-prismic": "^5.2.9". None of my queries aren't working . I figure out on this page https://prismic.io/docs/technologies/migrate-to-gatsby-source-prismic-gatsby that all the queries have changed. :cold_sweat: :cold_sweat: :cold_sweat: Now I have to changed all the sites queries.
For example one of my queries is like this:

let documents = []
  let proceed = true
  let endCursor = null

  while (proceed) {
    const result = await graphql(
      `
        query($endCursor: String) {
          prismic {
            _allDocuments(
              first: 20
              after: $endCursor
              type_in: ["doctor", "nurse"]
            ) {
              edges {
                node {
                  _meta {
                    lang
                    uid
                    type
                  }
                }
              }
              pageInfo {
                hasNextPage
                endCursor
                hasPreviousPage
                startCursor
              }
              totalCount
            }
          }
        }
      `,
      { endCursor }
    )

I get these errors:

I know that prismic word doesn't exist anymore, so what about _allDocuments ? what is the equivalent in "gatsby-source-prismic": "^5.2.9" ? what would be the best way to reformat this query?
thanks again,
James

Hello @james4, there's no equivalent option with the new plugin. You can format it by querying only the documents of a certain type. One query per Custom Type.

I can help you build your queries. Can you tell me more about your use case?

1 Like

Hi @Pau thanks for writing back,
I would do a union with the data results of these two types into one and returns the first 20 results with
the

pageInfo {
                hasNextPage
                endCursor
                hasPreviousPage
                startCursor
              }
              totalCount
            }

if you see my initial query on first message , you will have an idea of what i want, hope this helps,
thanks,
James

I see now. The main difference is that gatsby-source-prismic doesn't have cursors in the page queries.

We have a guide that teaches you how to create pagination with the new plugin. Check out the docs here: