Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 键上的条件数对于节点js无效的dynamo db_Node.js_Amazon Dynamodb - Fatal编程技术网

Node.js 键上的条件数对于节点js无效的dynamo db

Node.js 键上的条件数对于节点js无效的dynamo db,node.js,amazon-dynamodb,Node.js,Amazon Dynamodb,当使用上述代码时,我得到了res: docClient.update({ TableName: 'patient', Key: { "patientId": "TIGERPAT0001" }, UpdateExpression: "set title = :x, name = :y", ExpressionAttributeNames: { "#name": "name" }, ExpressionAttri

当使用上述代码时,我得到了res:

docClient.update({
    TableName: 'patient',
    Key: {
        "patientId": "TIGERPAT0001"
    },
    UpdateExpression: "set title = :x, name = :y",
    ExpressionAttributeNames: {
        "#name": "name"
    },
    ExpressionAttributeValues: {
        ":x": 'title value abc',
        ":y": 'name value xyz'
    }
}, function (err, data) {
    if (err) {
        json.status = '0';
        json.result = { 'error': 'Unable to Edit Patient : ' + JSON.stringify(err) };
        res.send(json);
    } else {
        json.status = '1';
        json.result = { 'sucess': 'Patient Edited Successfully :' };
        res.send(json);
    }
});

我遗漏了什么/有什么错误吗???

我想您在创建表时使用了多个键

如果在创建表时使用了
n
键数,那么这里还需要传递
n
键数

下面请注意,我们也在传递id1和id2密钥

例:

请用钥匙替换
id1
id2

Unable to Edit Patient Error : `{"message":"The number of conditions on the keys is invalid",
"code":"ValidationException", 
"time":"2017-09-13T07:12:56.608Z",
"requestId":"a01c707c-86b4-41a5-a1c5-92b9ea07c026",
"statusCode":400,"retryable":false,
"retryDelay":6.368631970657979}`
docClient.update({
    TableName: 'patient',
    Key: {
        "patientId": "TIGERPAT0001",
        "id1": "id1value",
        "id2": "id2value"
    },
    UpdateExpression: "set title = :x, #name = :y",
    ExpressionAttributeNames: {
        "#name": "name"
    },
    ExpressionAttributeValues: {
        ":x": 'title value abc',
        ":y": 'name value xyz'
    }
}, function (err, data) {
    if (err) {
        json.status = '0';
        json.result = { 'error': 'Unable to Edit Patient : ' + JSON.stringify(err) };
        res.send(json);
    } else {
        json.status = '1';
        json.result = { 'sucess': 'Patient Edited Successfully :' };
        res.send(json);
    }
});