replace.js
// Replaces existing item with new item
// Operation will fail if an item with the same key does not exist
// see also .insert_or_replace()
// WARN: use schema() to prevent describeTable call
DynamoDB
.table('tbl_name')
.return(DynamoDB.UPDATED_OLD)
.replace({
partition_key: 'test.com',
sort_key: 'test@test.com',
nine: 5 + 4,
width: ( 100 + 20 ) + 'px',
password: 'qwert',
// inserted as datatype SS
string_set1: DynamoDB.SS(['sss','bbb','ccc']),
string_set2: new Set(['sss','bbb','ccc']),
// inserted as datatype NS
number_set1: DynamoDB.NS([111,222,333]),
number_set2: new Set([[111,222,333]]),
// inserted as datatype L
list1: [7,9,15],
list2: new Set([]),
list3: new Set([ 'a', 1 ]),
created_at: new Date().getTime()
}, function(err,data) {
console.log( err, data )
});