DynamoDB AWSから単一の項目を取得しようとしていますが、ハッシュと範囲キーで指定する方法を理解できません。ここにいるdescribeTableで、出力をスキャン:ここgetItem()が「無効な属性値型」を返すのはなぜですか?
// describeTable output:
{
"Table": {
"AttributeDefinitions": [
{
"AttributeName": "timepost",
"AttributeType": "N"
},
{
"AttributeName": "addr",
"AttributeType": "S"
}
],
"TableName": "Scratch",
"KeySchema": [
{
"AttributeName": "timepost",
"KeyType": "HASH"
},
{
"AttributeName": "addr",
"KeyType": "RANGE"
}
],
"TableStatus": "ACTIVE",
"CreationDateTime": "2017-08-24T07:08:19.650Z",
"ProvisionedThroughput": {
"LastIncreaseDateTime": "1970-01-01T00:00:00.000Z",
"LastDecreaseDateTime": "1970-01-01T00:00:00.000Z",
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
},
"TableSizeBytes": 32,
"ItemCount": 1,
"TableArn": "arn:aws:dynamodb:ddblocal:000000000000:table/Scratch"
}
}
// scan output:
{
"Items": [
{
"addr": "1.1.1.1:443",
"ms": 67,
"timepost": 12321340
}
],
"Count": 1,
"ScannedCount": 1
}
は私のgetItem()コードとエラー出力は次のようになります。
docClient.get({
TableName: "Scratch",
Key: {
timepost: {N: '12321340'},
addr: {S: '1.1.1.1:443'}
}}, opComplete);
err: {
"message": "Invalid attribute value type",
"code": "ValidationException",
"time": "2017-08-26T15:56:59.938Z",
"requestId": "f9d94f20-f22d-4141-be06-2eaba1eee5a1",
"statusCode": 400,
"retryable": false,
"retryDelay": 26.507308215655236
}
私が間違って何をしているのですか?
これは私に「Invalid attribute value type」という同じエラーを返します。 – noctonura