aws / aws-sdk-ruby-record

Official repository for the aws-record gem, an abstraction for Amazon DynamoDB.
Apache License 2.0
318 stars 41 forks source link

"limit" in Query #74

Closed rhymer211 closed 6 years ago

rhymer211 commented 7 years ago

"limit" in query, it seems to be ignored

awood45 commented 6 years ago

I'd have to see a usage example - it definitely is not ignored by the client, but since it returns an auto-paging enumerable, if you use #each directly the client will dutifully keep calling #query to get new results.

awood45 commented 6 years ago

I'm actually working on an extension to aws-record functionality which should make this a bit more intuitive. Stand by...

awood45 commented 6 years ago

You can use limit in the way you're thinking in version 2.0.1 of the library. If you use #page on the scan/query response rather than #each or an Enumerable method, you'll get your first page of responses only. If you wish to call again for the next page, you can do so by re-calling your search method using the value in #last_evaluated_key.