0

Please help me to understand how to properly and correctly use the list-function of AWS Amplify.

After running into many issues of existing data not being found/retrieved, I found out that if no "limit" is set, the limit for the Query is always by default set to 100. Now for any table that I am querying from using "list", I have to set a very high "limit", to make sure that I am getting back the data that I am looking for.

Here is an example:

const userResponse = await client.models.User.list({
  filter: {
    email: { eq: userEmail }
  },
  limit: 10000
})

If i have more than 100 Users in the table and I dont have the "limit" set to a higher number, sometimes the data (in this case the user) cannot be found/retrieved.

Is it really right that I have to set a high limit to every single use case of "list"?

I would think that its only the limit for retrieved rows, but even though I am just looking for one or two entries in the table, to me it seems that I have to set the limit higher than the existing rows in the table.

What is the right way of dealing with this? Shall I always just set a really high limit-number wherever I use "list"?

Thanks a lot for any advice as well as examples on how you are using it.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.