reaction icon indicating copy to clipboard operation
reaction copied to clipboard

`getPaginatedResponseFromAggregate` throws error when query includes `hasNextPage` and `totalCount`

Open tedraykov opened this issue 4 years ago • 1 comments

When a plugin uses this method to format the response of a query, and the request includes either hasNextPage or totalCount property, the API throws error.

In the case of hasNextPage the errors is the following:

"count can only be used with find command"

An example query that causes this error is:

query {
  vendors(shopIds: []) {
    nodes {
    name
    }
    pageInfo {
      hasNextPage
    }
  }
}

In the case of totalCount the error is:

"Invalid $addFields :: caused by :: FieldPath field names may not start with '$'."

An example query that causes this error is:

query {
  vendors(shopIds: []) {
    nodes {
    name
    }
    totalCount
  }
}

tedraykov avatar Sep 16 '21 16:09 tedraykov

Hi, I'd like to work on this issue—could you please assign it to me?

omchaudhary007 avatar Oct 13 '24 05:10 omchaudhary007