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

Fixing problem where if primary key starts with underscore Model.create doesn’t work #502

Merged
merged 1 commit into from
Dec 17, 2018
Merged

Fixing problem where if primary key starts with underscore Model.create doesn’t work #502

merged 1 commit into from
Dec 17, 2018

Conversation

fishcharlie
Copy link
Member

Summary:

This PR fixes a problem where if your primary key starts with an underscore Model.create will fail.

Code sample:

General

Cats.Cat12.create({_id: 666, name: 'Garfield'}, function (err, garfield) {
  should.not.exist(err);
  should.exist(garfield);
  done();
});

Type (select 1):

  • Bug fix
  • Feature implementation
  • Documentation improvement
  • Testing improvement
  • Test added to report bug (GitHub issue #--- @---)
  • Something not listed here

Is this a breaking change? (select 1):

  • 🚨 YES 🚨
  • No
  • I'm not sure

Is this ready to be merged into Dynamoose? (select 1):

  • Yes
  • No

Are all the tests currently passing on this PR? (select 1):

  • Yes
  • No

Other:

  • I have searched through the GitHub pull requests to ensure this PR has not already been submitted
  • I have updated the Dynamoose documentation (if required) given the changes I made
  • I have added/updated the Dynamoose test cases (if required) given the changes I made
  • I have run npm test from the root of the project directory to ensure all tests continue to pass
  • I agree that all changes made in this pull request may be distributed and are made available in accordance with the Dynamoose license
  • All of my commits and commit messages are detailed, explain what changes were made, and are easy to follow and understand
  • I have confirmed that all my code changes are indented properly using 2 spaces
  • I have filled out all fields above

@fishcharlie
Copy link
Member Author

@brandongoode Thoughts on this? I'm not sure if _ is the only case we should be looking for here. I tried to skim through the DynamoDB documentation very briefly and couldn't find any other cases we should account for. Maybe it would be safer to try to write a regex to check to see if the first character is not a normal letter?

@coveralls
Copy link

coveralls commented Dec 8, 2018

Pull Request Test Coverage Report for Build 797

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 85.473%

Totals Coverage Status
Change from base Build 791: 0.1%
Covered Lines: 2146
Relevant Lines: 2435

💛 - Coveralls

@fishcharlie fishcharlie mentioned this pull request Dec 11, 2018
@fishcharlie fishcharlie merged commit 1a0dcf7 into dynamoose:master Dec 17, 2018
@fishcharlie fishcharlie deleted the createWithUnderscorePrimaryKeyError branch December 17, 2018 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants