- 최신
- 최다 투표
- 가장 많은 댓글
The low-level Query API requires specifying the data type:
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
However, there are higher-level Document Clients available that abstract this for you, allowing you to pass a value (string, number, bool, etc.) as-is to the higher-level query API, and the DocumentClient will translate that to the low-level API for you. Big time saver:
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/dynamodb-example-document-client.html https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html
Example:
var params = {
TableName: 'Table',
IndexName: 'Index',
KeyConditionExpression: 'HashKey = :hkey and RangeKey > :rkey',
ExpressionAttributeValues: {
':hkey': 'key',
':rkey': 2015
}
};
var documentClient = new AWS.DynamoDB.DocumentClient();
documentClient.query(params, function(err, data) {
if (err) console.log(err);
else console.log(data);
});
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#query-property
Also, per docs:
QueryFilter
- This is a legacy parameter. Use FilterExpression instead. For more information, see QueryFilter in the Amazon DynamoDB Developer Guide.
관련 콘텐츠
- AWS 공식업데이트됨 6달 전