1
让我们说我在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?
问候
它的工作。谢谢 :) – wapt49