删除dynamodb中的嵌套属性

假设我在dynamodb中获得了这个项目:

{ "customerId": "customer_001", "customerName: "itsme", "address": { "city": "Frankfurt", "country": "Germany", "street1": "c/o Company xxx", "street2": "Europe", "street3": "PO Box 406", "zip": "12345" } } 

我需要从项目中删除嵌套的属性address.street3。 我怎么能做到这一点?

这是我的代码,它完美地删除非嵌套的属性(例如:customerName),但如果我尝试使用嵌套属性(例如:address.street3)不起作用(没有错误及没有发生)

 const params = { TableName: customerTable, Key: { customerId: customerId, }, AttributeUpdates: { 'address.street3': { Action: 'DELETE' } } }; dynamoDb.update(params, function (err, data) { if (err) { console.error("Unable to update customer. Error JSON:", JSON.stringify(err, null, 2)); } else { console.log("UpdateCustomer succeeded:", JSON.stringify(data.Attributes)); responseHelper.ResponseHelper.success(JSON.stringify(data.Attributes), 200, callback); } }); 

有人可以帮我我该怎么做才能删除属性address.street3?

问候

这里是删除“address.street3”属性的代码。

 var docClient = new AWS.DynamoDB.DocumentClient(); var params = { TableName : "customer", Key : { "customerId": "customer_001" }, UpdateExpression : "REMOVE address.street3", ReturnValues : "UPDATED_NEW" }; console.log("Updating the item..."); docClient.update(params, function(err, data) { if (err) { console.error("Unable to update item. Error JSON:", JSON.stringify(err, null, 2)); } else { console.log("UpdateItem succeeded:", JSON.stringify(data)); } });