Skip to content

Commit

Permalink
set the dynamodb query command Limit option to options.limit by default
Browse files Browse the repository at this point in the history
  • Loading branch information
autopulated committed May 1, 2024
1 parent 4727a7d commit 5f206c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,11 @@ class BaseModel {
ExpressionAttributeValues: mergedExprAttributeValues,
ExpressionAttributeNames: mergedExprAttributeNames,
...(ExclusiveStartKey && {ExclusiveStartKey}),
// TODO: not sure if this will mess up pagination?
// set the dynamodb Limit to the options limit, or the maximum supported, so that we don't evaluate more items than necessary
// ...(options.limit && {Limit:options.limit})
// set the dynamodb Limit to the options limit, so that we don't
// evaluate more items than necessary. If making a query with a
// filter expression it may make sense to specify a larger limit,
// in which case that can be specified in otherOptions.Limit
...(options.limit && {Limit: options.limit})
}, otherOptions);
}
}
Expand Down

0 comments on commit 5f206c0

Please sign in to comment.