Deleting multiple records in dynamo db

后端 未结 4 914
轮回少年
轮回少年 2021-01-12 22:54

can we delete multiple records in dynamo db only through range key?

I\'m trying to do like this sql statement

delete from employee where emplo

4条回答
  •  离开以前
    2021-01-12 23:23

    Please Check This query it's working with multiple data

    const params = {TableName: "test"};
    
    docClient.scan(params, (error, result) => {
            if (error) { console.log(error,"error scan"); }
    
            result.Items.forEach(function(item) {          
                docClient.delete({Key:{mainID: item.id},TableName:"test"}, (error) => {
                    if (error) {
                        console.log("Delete fail");
                    }
                    console.log("Delete  Success");
                });
            });
    
    });    
    

提交回复
热议问题