ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.22k stars 744 forks source link

Connection.totalCount returns -1 when it should return 0 using Entity Framework #7648

Open willgittoes opened 3 hours ago

willgittoes commented 3 hours ago

Product

Hot Chocolate

Version

14.0.0

Link to minimal reproduction

https://github.com/ChilliCream/hotchocolate-examples/pull/65

Steps to reproduce

totalCount returns -1 when it should return 0

  1. Check out and run the updated Contoso blog example from here: https://github.com/ChilliCream/hotchocolate-examples/pull/65
  2. Run the following query:
    query {
    students ( first:10, where: {id: {eq: 69}} ) {
    nodes {
      id
    }
    totalCount
    }
    }

What is expected?

The following response:

{
  "data": {
    "students": {
      "nodes": [],
      "totalCount": 0
    }
  }
}

What is actually happening?

The following response:

{
  "data": {
    "students": {
      "nodes": [],
      "totalCount": -1
    }
  }
}

Relevant log output

No response

Additional context

No response

willgittoes commented 3 hours ago

ALSO: If you remove first: 10 from the query, I get the error:

{
  "errors": [
    {
      "message": "Exactly one slicing argument must be defined.",
      "locations": [
        {
          "line": 2,
          "column": 4
        }
      ],
      "path": [
        "students"
      ],
      "extensions": {
        "code": "HC0082"
      }
    }
  ]
}