clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels
Other
490 stars 110 forks source link

query() with limit() does not return LastEvaluatedKey #80

Closed marckaraujo closed 6 years ago

marckaraujo commented 7 years ago

If you use scan() with startKey() then you'll receive LastEvaluatedKey but if you use query() instead then LastEvaluatedKey is empty.

CashierHistory
             .query(path['userId'])
            .limit(2)
            .startKey(queryString)
            .exec(function (err, acc) {
                if (err == null) {
                    console.log(acc);
                    return cb(null, Api.response(acc));
                } else {
                    console.log(err['message']);
                    return cb(null, Api.errors(200, {5: err['message']}));
                }
            });

As described in AWS docs "LastEvaluatedKey is only provided if you have used the Limit parameter, or if the result set exceeds 1 MB (prior to applying a filter)."

cdhowie commented 6 years ago

@marckaraujo Are you sure that the result set of this query has more than two items? LastEvaluatedKey is only returned if there are more results to collect.

jkav77 commented 6 years ago

I edited the title of the issue for clarity. This is an old issue with not activity so I will close and we can reopen if @marckaraujo responds.