[Apollostack] LImit / Count

Hi, im trying to implement what i learnt on Kadira GraphQL on my own server.

When i try to do a Limit / Count of a query i get

{
  "errors": [
    {
      "message": "Unknown argument \"limit\" on field \"Name\" of type \"Query\".",
      "locations": [
        {
          "line": 2,
          "column": 11
        }
      ]
    }
  ]
}

And what does your actual command look like?

You need to define the limit and count arguments in your schema. Something like this:

Query {
  Name(count: Int, limit: Int): String
}

@helfer when i do that, and i debug the query it show

SELECT 'col','anothercol' FROM 'somewhere' 'somewhere' WHERE 'somewhere'.'limit' = '10'

@robfallows

my command looks like this:

{
    sqlSomething(limit: 10){
       col
       anothercol
    }
}

How do you generate your SQL query?

Hereā€™s a working example for paginationā€¦ http://sandbox.kāla.com/data-emulation/paginate

1 Like