在DynamoDB表中country
是主键createdAt
是排序键,我想查询country
是USA
、城市是San Francisco
、街道不是Market street
的项目。但是,即使一个表中有多个项目,query
命令也不会返回结果。我在这里做错了什么:
import { DynamoDB } from 'aws-sdk';
db = new DynamoDB.DocumentClient({ apiVersion: '2012-08-10', service: new DynamoDB() })
params = {
TableName: 'my-table',
IndexName: 'country-createdAt',
KeyConditionExpression: 'country = :country',
FilterExpression: 'street <> :street and city = :city',
ExpressionAttributeValues: {
':country': 'USA',
':street': 'Market street',
':city': 'San Francisco'
}
}
let output = await db.query(params);
结果如下:
{ Items: [], Count: 0, ScannedCount: 200 }
目前没有回答
相关问题 更多 >
编程相关推荐