amplify-cli: Filtering on weeknumbers greater then 10 doesn't return results
I’m having a table of around 4000 recipes. Every recipe has a weeknumber.
When I run:
this.apiService.ListRecipes({ weeknumber: { eq: moment().week() } }, 4000)
I get zero results sinds it is currently week 20
It only works when entering a static number between 1 and 10. My table Recipes has also records with weeknumbers between 11 and 52
Another unexpected behavior is, that it is performing the limit: 4000 before filtering the weeknumbers.
I was expecting it would first ask the database for all entries with weeknumber X and then limit the results.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 16 (3 by maintainers)
If you need to download 5MB of data, you can use a recursive approach. Here is a draft of how it looks like:
Ok the dynamoDB scan function indeed first limits the results and apply the filtering on that subset, this is not a very helpful order in my opinion.
You wouldn’t believe the reason behind why I’m only getting back records for week 1 to 10. My total table size is 5,56MB Divide this bij 52 weeks and I’m on 0.1MB per week. Times 10 and I’m on 1MB which is unbelievable the maximum data size for the scan operation!
This took me 11 hours of debugging to find the reason.
So how on earth are other companies getting API’s build with all these limits?