I have a table called Message in dynamodb. The key is composed of a Hash (called entryStamp as a Number), and a Range ( userId as a String).
I'm trying to do a getItem on it using Node.js Lambda. I know how to getItem for a different table with a Hash only key, and it works.
But I can't find documentation on how to modify my json to express the Range part of the key.
var params = {
"ConsistentRead": false,
"Key": {
HashKeyElement: { N: desiredSendStamp },
RangeKeyElement: { S: userId }
},
"ProjectionExpression": "message",
"ReturnConsumedCapacity": "NONE",
"TableName": "Message"
}
Thanks in advance! When I send the above to getItem, I get this:
"errorMessage": "The provided key element does not match the schema",
"errorType": "ValidationException",
"stackTrace": [
"Request.extractError (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/protocol/json.js:40:27)",
"Request.callListeners (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/sequential_executor.js:100:18)",
"Request.emit (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/sequential_executor.js:77:10)",
"Request.emit (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/request.js:604:14)",
"Request.transition (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/request.js:21:12)",
"AcceptorStateMachine.runTo (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/state_machine.js:14:12)",
"/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/state_machine.js:26:10",
"Request.<anonymous> (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/request.js:22:9)",
"Request.<anonymous> (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/request.js:606:12)",
"Request.callListeners (/var/runtime/node_modules/dynamodb-doc/node_modules/aws-sdk/lib/sequential_executor.js:104:18)"
]
}
Aucun commentaire:
Enregistrer un commentaire