reactioncommerce/reaction

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

開放

#6,509 建立於 2021年9月16日

 (1 則留言) (4 個反應) (0 位負責人)JavaScript (2,198 個分叉)batch import
bughelp wanted

倉庫指標

星標
 (12,181 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南