Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scanByRawFilter containing - Select: 'COUNT' #341

Merged

Conversation

bsimpson53
Copy link
Contributor

Trying to do a Select: 'COUNT' on a raw filter scan like:

var Dog = dynamoose.model('Dog');
var filter = {
  FilterExpression: 'details.timeWakeUp = :wakeUp',
  ExpressionAttributeValues: {
    ':wakeUp': '8am'
  },
  Select: 'COUNT'
};
Dog.scan(filter, { useRawAwsFilter: true }).exec()

generates this error:

Uncaught TypeError: Cannot read property 'map' of undefined
      at Response.<anonymous> (node_modules/dynamoose/lib/Scan.js:82:45)

Intercept the case where a raw filter scan where data is defined but data.Items is unpopulated and therefore by elimination the filter must have contained Select: 'COUNT'

…data.Items

is unpopulated and therefore by elimination the filter must have contained
```Select='COUNT'```

Accompanying test added.
Copy link
Member

@fishcharlie fishcharlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fishcharlie
Copy link
Member

Thanks so much for this @bsimpson53, we will for sure try to get this in for version 0.9! Thanks again!!

@fishcharlie fishcharlie added this to the v0.9.0 milestone Apr 19, 2018
@fishcharlie fishcharlie modified the milestones: v0.9.0, v1.0 Jun 13, 2018
@fishcharlie fishcharlie mentioned this pull request Jun 13, 2018
@fishcharlie fishcharlie merged commit bd40387 into dynamoose:master Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants