-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
take()/limit() not available? #73
Comments
Does it work when you have where conditions? It is quite inefficient to do a get all in dynamodb. That is doing a limit of 1000 might not really give you 1000 because of the scan limit. |
Because of how Limit works in DynamoDb, ... it does work with where conditions ... but if your table has 1000 items which might be returned, and a total of 5000 items ... Model::where($condition)->take(1000)->get() may return less than 1000 items ... To get it to return the 1000 results that would match, we'd have to call the query multiple times using the LastEvaluatedKey until we have >= Limit items to return ... then we only return Limit items in the Collection, discarding any extras. Perhaps taking advantage of 'chunk' ... and changing the At the moment, I just needed a way to reduce the number of items being returned as my table has thousands ... and for testing, I only wanted a handful of them.
|
Looks like the Query Builder's "take" and "limit" methods are not available, preventing you from limiting the results returned.
The "getAll" method has a $limit parameter, but this also does not appear to work due to the "use_iterator" parameter being defaulted to true.
Changing the default to false for $user_iterator, and adding the following code to the DynamoDbBuilder class seems to allow "take()/limit()" to work as expected.
The text was updated successfully, but these errors were encountered: