Comparing version 0.5.7 to 0.5.8
@@ -195,7 +195,7 @@ 'use strict'; | ||
_.each(schema.globalIndexes, function (keys) { | ||
if(hashKey[keys.hashKey]){ | ||
if(_.has(hashKey, keys.hashKey)){ | ||
obj[keys.hashKey] = hashKey[keys.hashKey]; | ||
} | ||
if(hashKey[keys.rangeKey]){ | ||
if(_.has(hashKey, keys.rangeKey)){ | ||
obj[keys.rangeKey] = hashKey[keys.rangeKey]; | ||
@@ -206,3 +206,3 @@ } | ||
_.each(schema.secondaryIndexes, function (rangeKey) { | ||
if(hashKey[rangeKey]){ | ||
if(_.has(hashKey, rangeKey)){ | ||
obj[rangeKey] = hashKey[rangeKey]; | ||
@@ -209,0 +209,0 @@ } |
{ | ||
"name": "vogels", | ||
"version": "0.5.7", | ||
"version": "0.5.8", | ||
"author": "Ryan Fitzgerald <ryan@codebrewstudios.com>", | ||
@@ -5,0 +5,0 @@ "description": "DynamoDB data mapper", |
@@ -100,2 +100,19 @@ 'use strict'; | ||
it('should handle boolean global secondary index key', function () { | ||
schema.String('email', {hashKey: true}); | ||
schema.Number('age'); | ||
schema.String('name'); | ||
schema.Boolean('adult'); | ||
schema.globalIndex('GameTitleIndex', { | ||
hashKey: 'adult', | ||
rangeKey: 'email' | ||
}); | ||
var data = { email : 'test@example.com', adult: false }; | ||
var keys = serializer.buildKey(data, null, schema); | ||
keys.should.eql({email: {S: 'test@example.com'}, adult: {N : '0'}}); | ||
}); | ||
}); | ||
@@ -102,0 +119,0 @@ |
164798
3893