DynamoDb BatchWriteItem在删除项目时给出错误?

时间:2018-06-05 10:02:47

标签: node.js amazon-web-services nosql amazon-dynamodb

     var itemArray = [] ; 
      itemArray.push({DeleteRequest: {
    Key: {
        'userId': { S: tempNOuserID },
        's_No': { N: 2 },
    }}
      });

 itemArray.push({DeleteRequest: {
    Key: {
        'userId': { S: tempNOuserID },
        's_No': { N: 1 },
    }}
      });
    var params = {
        RequestItems: {'sampleData':itemArray}   
    };

    console.log(params)


    docClient.batchWrite(params, function(err, data) {
        if (err) {
            console.log('Batch delete unsuccessful ...');
            console.log(err, err.stack); // an error occurred
        } else {
            console.log('Batch delete successful ...');
            console.log(data); // successful response
        }

    });

我正在使用它来批量删除,但它提供错误提供的关键元素与架构不匹配 userId和S-NO是复合键,userId是散列键,s_no是排序键,那么如何批量删除数据呢?

0 个答案:

没有答案