简体   繁体   English

JavaScript:阅读AWS dynamodb项目

[英]JavaScript: Read an item AWS dynamodb

I'm trying to read the data on my table_user in dynamodb: My database [Please look] 我正在尝试在dynamodb中读取table_user上的数据: 我的数据库[请查看]

 AWS.config.update({
  region: "us-west-2",
  endpoint: 'https://dynamodb.us-west-2.amazonaws.com/',
  // accessKeyId default can be used while using the downloadable version of DynamoDB. 
  // For security reasons, do not store AWS Credentials in your files. Use Amazon Cognito instead.
  accessKeyId: "fake",
  // secretAccessKey default can be used while using the downloadable version of DynamoDB. 
  // For security reasons, do not store AWS Credentials in your files. Use Amazon Cognito instead.
  secretAccessKey: "fake"
});

var docClient = new AWS.DynamoDB.DocumentClient();

function queryData() {
    document.getElementById('textarea').innerHTML += "Querying for movies from 1985.";

   var table = "table_users";


var title = "love";

var params = {
    TableName: table,
    Key:{
        "rawa_rese": title
    }
};

docClient.get(params, function(err, data) {
    if (err) {
        console.error("Unable to read item. Error JSON:", JSON.stringify(err, null, 2));
    } else {
        console.log("GetItem succeeded:", JSON.stringify(data, null, 2));
    }
});
}

But getting: 但是得到:

Unable to read item. 无法读取项目。 Error JSON: { "message": "Requested resource not found", "code": "ResourceNotFoundException", "time": "2018-12-27T17:17:56.207Z", "requestId": "G06LO9DH60AB9OK419826ISNJNVV4KQNSO5AEMVJF66Q9ASUAAJG", "statusCode": 400, "retryable": false, "retryDelay": 0, "line": 36, "column": 29583, "sourceURL": " https://sdk.amazonaws.com/js/aws-sdk-2.7.16.min.js " } 错误JSON:{“消息”:“找不到请求的资源”,“代码”:“ ResourceNotFoundException”,“时间”:“ 2018-12-27T17:17:56.207Z”,“ requestId”:“ G06LO9DH60AB9OK419826ISNJNVV4KQNSO5AEMVJF66Q9ASUAAJG” “:400,”可重试“:false,” retryDelay“:0,”行“:36,”列“:29583,” sourceURL“:” https://sdk.amazonaws.com/js/aws-sdk-2.7 .16.min.js “}

How do i get this record love ? 我如何获得这张唱片love

It's just a typo. 这只是一个错字。 You have used table_users where the table name is table_user 您使用过table_users ,其中表名称为table_user

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM