我正在尝试使用Filter Expression在GSI中执行查询,但AWS一直告诉我没有找到表达式。 查询如下:
var tableQuery = {
TableName: "posts",
KeyConditionExpression: "#wy = :wkYr",
FilterExpression: "#ac = :isAct",
IndexName: "weekYear-date-index",
ScanIndexForward: false,
Limit: 50,
ExpressionAttributeNames: {
"#wy": "weekYear",
"#ac": "isActive"
},
ExpressionAttributeValues: {
":wkYr": cWeekYear,
":isAct": {BOOL: true}
}
};
并显示错误:
An expression attribute value used in expression is not defined; attribute value: :isAct
我一直在尝试不同的方法,但似乎没有任何效果,任何想法?
当前查询的控制台日志:
{
"TableName": "posts",
"KeyConditionExpression": "#wy = :wkYr",
"FilterExpression": "#ac = :isAct",
"IndexName": "weekYear-date-index",
"ScanIndexForward": false,
"Limit": 50,
"ExpressionAttributeNames": {
"#wy": "weekYear",
"#ac": "isActive"
},
"ExpressionAttributeValues": {
":wkYr": 2040,
":isAct": {
"BOOL": true
}
}
}
答案 0 :(得分:0)
这就是您应该传递自己的价值的方式
":isAct": true