-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Hello Victor,
It seems that scan ignores {ExclusiveStartKey: <startkey>} when passed in as an argument, I took a deeper look into this and I found the following
https://github.com/victorquinn/dynasty/blob/master/src/lib/aws-translators.coffee#L106
awsParams =
TableName: @name
ScanFilter: {}
Select: 'SPECIFIC_ATTRIBUTES'
AttributesToGet: params.attrsGet || [keySchema.hashKeyName]
Limit: params.limit
TotalSegments: params.totalSegment
Segment: params.segment
There is no mention of ExclusiveStartKey. Not too bad to fix this, just need to add
ExclusiveStartKey: params.ExclusiveStartKey if you want it to adhere to the dynastyjs documentation
Also scan should return a LastEvaluatedKey, however when doing
https://github.com/victorquinn/dynasty/blob/master/src/lib/aws-translators.coffee#L128
@parent.dynamo.scanAsync(awsParams)
.then (data)->
dataTrans.fromDynamo(data.Items)
.nodeify(callback)
The LastEvaluatedKey is not passed to the user as it exists in data.LastEvaluatedKey,
Ideally, this should be doing something along the lines of
@parent.dynamo.scanAsync(awsParams)
.then (data)->
result =
Items: dataTrans.fromDynamo(data.Items),
Count: data.Count,
LastEvaluatedKey: data.LastEvaluatedKey
.nodeify(callback)
This way the fromDynamo function can remain as is and the information can propagate through to the user
