1 回答
- 最新
- 投票最多
- 评论最多
0
【以下的回答经过翻译处理】 低级别的查询 API 需要指定数据类型:
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
但是,也有更高级别的文档客户端可用,可为您抽象这个过程,允许您将一个值(字符串、数字、布尔等)原样传递到更高级别的查询 API 中,并且文档客户端会为您将其转换为低级别的 API,从而节省大量时间:
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
例子:
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
另外,根据文档:
QueryFilter
- 这是一个遗留参数。请改用 FilterExpression。有关更多信息,请参阅 Amazon DynamoDB 开发人员指南中的 QueryFilter。
相关内容
- AWS 官方已更新 9 个月前
- AWS 官方已更新 2 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 3 年前