reactioncommerce/reaction

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

Open

#6.509 aberto em 16 de set. de 2021

Ver no GitHub
 (1 comment) (4 reactions) (0 assignees)JavaScript (2.198 forks)batch import
bughelp wanted

Métricas do repositório

Stars
 (12.181 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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
  }
}

Guia do colaborador