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 for: boolean values converted to strings instead of numbers #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bfil
Copy link

@bfil bfil commented Jul 11, 2012

Boolean values should be converted to numbers on DynamoDB, in this way we can have the following item with boolean properties:

var item = { hash: "whatever", isBetter: true, isWorse: false };
item.put();

And it can be retrieved and tested in the following way:

var item = table.get_item({hash: "whatever"});
item.isBetter == true; // true
item.isWorse == false; // true

Because in Javascript (and many other languages):

1 == true; // true
0 == false; // true

@ryanfitz
Copy link
Member

This is a great fix, I'm going to pull this in for the next major update to dynode as this changes the way data is stored. I also have to add in some details to the readme about boolean handling.

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