0

I have an Amplify application, using a DynamoDB table with ~50 items and accessing it via a React app.

The initial (simplified) model:

type Video @model
@key(name: "ByOrganization", fields: ["videoOrganizationId", "id"], queryField: "videosByOrganization")
{
  id: ID!
  createdAt: AWSDateTime
  title: String!
  season: Int
  episode: Int
  owner: String
  editor: String
  organization: Organization @connection
  videoOrganizationId: ID
}

on the code I call this query on an Apollo React component:

  <Query
    query={query}
    variables={{
      {
         limit: 100,
      },
    }}
    pollInterval={5000}
  >
      {children}
  </Query>);

The limit of 100 items should be enough to bring all items from the database, however, it is not what happens, and it limit it to a number of items (~20-30 items)

I have tried adding different indexes to the table:

@key(name: "ByOrganizationSortedByCreated", fields: ["videoOrganizationId", "createdAt"], queryField: "videosByOrganizationSortedByCreated")
@key(name: "ByOrganizationSortedByTitle", fields: ["videoOrganizationId", "title"], queryField: "videosByOrganizationSortedByTitle")
@key(name: "ByOrganizationSortedByTitleSeasonEpisode", fields: ["videoOrganizationId", "title", "season", "episode"], queryField: "videosByOrganizationSortedByTitleSeasonEpisode")

None of them have worked Some items that clearly should be returned on my query are left behind

I also was trying to find any reference about limitatinos on DynamoDb number of returned items, or some odd behaviour that I'm not aware of... no success

There is also some super weird behaviours ie: if I just add a sortDirection: 'DESC', it returns less results!

Does anyone has any idea why is this happening?

dfranca
  • 5,156
  • 2
  • 32
  • 60
  • I am having a similar issue. When I use a sort or filter parameter, the query does return only a certain amount of results and a nextToken. Apparently, it cuts the list to the specified limit and then queries those first results. I would like to know as well if there is any configuration or workaround to this other than keep querying until running out of nextTokens. – Carlos Andres Aug 22 '21 at 02:24
  • @CarlosAndres not that I'm aware of, I had to do the same thing you mentioned – dfranca Aug 23 '21 at 07:39

0 Answers0