[Apollostack] LImit / Count


#1

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

#2

And what does your actual command look like?


#3

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

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

#4

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

#5

How do you generate your SQL query?


#6

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