Permalink
Browse files

putItem can map resulting attributes

  • Loading branch information...
1 parent 0f84a0c commit 5679807b2e8d438a3915b1c28fc5711586b77393 @extrabacon committed Oct 24, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/model.js
View
@@ -87,7 +87,10 @@ var DynamoModel = function (tableName, schema, options) {
this.ensureActiveTable(function (err) {
if (err) return callback(err);
- instance.dynamodb.putItem(params, callback);
+ instance.dynamodb.putItem(params, function (err, response) {
+ if (err) return callback(err);
+ callback(null, schema.mapFromDb(response.Attributes), response);
+ });
});
};
@@ -237,11 +240,11 @@ var DynamoModel = function (tableName, schema, options) {
};
DynamoModel.prototype.waitForActiveTable = function (pollingTimeout, callback) {
-
if (typeof pollingTimeout === 'function') {
callback = pollingTimeout;
pollingTimeout = null;
}
+ callback = callback || function () {};
pollingTimeout = pollingTimeout || 3000;
async.waterfall([

0 comments on commit 5679807

Please sign in to comment.