awspilot / dynamodb-oop

Speak fluent DynamoDB, write code with fashion, I Promise() 😃
https://awspilot.dev
MIT License
119 stars 28 forks source link

version 0.1.44 is not backward compatibile with 0.1.33 #8

Closed loen closed 8 years ago

loen commented 9 years ago

Hi,

I'm afraid that new version of your library api is not backward compatible with 0.1.33 version. For instance in following code

var command = dynamodb.table(tablePrefix + table);
    for (var key in query) {
        command = command.where(key).eq(query[key]);
    }
    command.get(callback);

in callback function I used following:

function (result) {
        return result[0];
    }

after update to version 0.1.44 I had to use return result[0][0] because additional layer in result array appeared.

adrianpraja commented 9 years ago

Hi Loen,

I did not see this issue before, I looks like a serious bug. Ill get back after some tests

loen commented 9 years ago

Hi databank, If you have any additional questions just let me know I'll try to answer

adrianpraja commented 9 years ago

Hi Loen,

I installed both versions did a few tests and got no different results

things to mention in your code snippet above:

1) you do not need to use command = command.where(key).eq(query[key]); just command.where(key).eq(query[key]); should be enaugh

2) callback should be callback(err, result) and not callback(result)

3) result parameter in the callback is an object not array, result[0] and result[0][0] does not make sense

If possible please provide more details on how to reproduce the issue you were seeing

thanks