So I have a model set up similar to the example in the docs, with a named connection. The generated query correctly return items for the connection, but, it only gives back 10 items and a nextToken. How do I go about to actually use the nextToken in this case. Or how can I change the limit similar to the list queries to get more items out from the connection? Do I have to hook this all up in the resolver manually?
type User @model {
id: ID!
posts: [Post] @connection(name: "UserPosts", sortField: "createdAt")
}
type Post @model {
id: ID!
user: User! @connection(name: "UserPosts", sortField: "createdAt")
text: String
}
query GetUserAndPost {
getUser(id: "...") {
id
posts {
items {
id
test
}
nextToken
}
}
}
An example I used in another post that I think will work for you.. try this out
query getBlog{
getBlog(id:"whatever"){
name
Posts(limit:20, nextToken:"whatever"){
items{
title
}
}
}
}
@wizawuza works. Thanks a lot.
Similarly, if you're using nextToken for pagination, it does the filter _after_ limiting.
In my case, I only want entries with this filter and limit: listEntries(nextToken: $nextToken, filter: {public_profile: {eq: true}}, limit: 5)
If I hit an entry where public_profile is false it can show only 4, 3, sometimes 2 entries.
Most helpful comment
An example I used in another post that I think will work for you.. try this out