从dynamoDB项中删除嵌套属性-Node.js [英] Remove nested attributes from dynamoDB Items - nodejs

查看:101
本文介绍了从dynamoDB项中删除嵌套属性-Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在dynamodb中有一个项目

I have a single item in dynamodb

{
    "id": "123",
    "201907240815": {
        "userid1": {
            "name": "Hello",
            "email": "test@example.com"
        },
        "userid2": {
            "name": "World",
            "email": "world@example.com"
        }
    }
}

我需要删除嵌套属性。例如: 201907240815.userid1

I need to remove the nested attribute. ex:201907240815.userid1.

我不得不尝试下面的代码,但是没有用

I had to try below code but it not worked

const param = {
    TableName:'userinfo',
    Key:{id:'123'},
    UpdateExpression:'remove 201907240815.userid1',
    ReturnValues: 'UPDATED_NEW'
}
try{
const response = await dynamoDB.update(param).promise();
return response;
}catch(e){
return e;
}

无法删除该属性。我遇到了这个问题。

It could not be remove the attribute. I got this issue.

ValidationException: Invalid UpdateExpression: Syntax error; token: "201907240815", near: "remove 201907240815."


推荐答案

我认为删除应大写:删除

I think that 'remove' should be capitalized: 'REMOVE'

这篇关于从dynamoDB项中删除嵌套属性-Node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆