@awspilot/dynamodb

Issue Star Fork
insert_or_update.js
// Insert on Duplicate Item Update // WARN: use schema() to prevent describeTable call DynamoDB .table('demo_table_hash_range') .return(DynamoDB.UPDATED_OLD) .insert_or_update({ partitionKey: 'foo.bar', sortKey: 1, password: 'qwert', firstname: 'Smith', number: 5, // increment by 5 page_views: DynamoDB.add(5), // nested attributes list: [5,'a', {}, [] ], // push these elements at the end of the list (L) phones: DynamoDB.add([5,'a']), // add to SS, string_set: DynamoDB.add(DynamoDB.SS(['ddd','eee'])), // add to NS, number_set: DynamoDB.add(DynamoDB.NS([444,555])), unneeded_attribute: DynamoDB.del(), // remove elements from stringSet unneeded_ss_items: DynamoDB.del(DynamoDB.SS(['ccc','ddd'])), // remove elements from numberSet unneeded_ns_items: DynamoDB.del(DynamoDB.NS([111,444])), }, function( err, data ) { console.log( err, data ) });