prisma-binding icon indicating copy to clipboard operation
prisma-binding copied to clipboard

error when trying to call aggregate function

Open thormengkheang opened this issue 7 years ago • 1 comments

I can query customersConnection via GraphQL playground but I can't access vai code like in the document https://www.prisma.io/docs/prisma-client/basic-data-access/reading-data-JAVASCRIPT-rsc2/#aggregations

await prisma.customersConnection().aggregate().count()

got an error like this

{
  "data": null,
  "errors": [
    {
      "message": "prisma.customersConnection is not a function",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "customers"
      ]
    }
  ]
}

thormengkheang avatar Sep 16 '19 03:09 thormengkheang

I have the same issue with Prisma-binding

const bookCount = await prisma.query.usersConnection().aggregate().count();

console.log(bookCount)


TypeError: prisma.query.usersConnection(...).aggregate is not a function
    at _callee3$ (/home/ayman/graphql/docker-postgres/src/resolvers/mutations/Book.js:82:68)
    at tryCatch (/home/ayman/graphql/docker-postgres/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/home/ayman/graphql/docker-postgres/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/home/ayman/graphql/docker-postgres/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/home/ayman/graphql/docker-postgres/src/resolvers/mutations/Book.js:17:191)
    at /home/ayman/graphql/docker-postgres/src/resolvers/mutations/Book.js:17:361
    at process._tickCallback (internal/process/next_tick.js:68:7)

al-ani avatar Oct 20 '19 09:10 al-ani