mapbox / dyno

simple dynamodb client
MIT License
78 stars 31 forks source link

Auto-paginate .query and .scan requests #115

Closed rclark closed 8 years ago

rclark commented 8 years ago

Propose adding an additional numeric parameter Pages to query and scan requests. These would come in alongside all the other options that the aws-sdk already accepts. The idea would be:

So an example request like this one would return up to 10 pages of results:

dyno.query({
  ExpressionAttributeNames: { '#c': 'collection' },
  ExpressionAttributeValues: { ':c': 'my-collection' },
  KeyConditionExpression: '#c = :c',
  Pages: 10
}, function() {});

The response should look identical to the response for any single page, except that data.Items would include all the records that were read. Additionally, if ReturnConsumedCapacity is requested, those metrics should be the sum of capacity consumed by all the requests performed.

cc @mick