檢查過AWS文檔,但沒有找到任何工作示例。如何在使用數組的FilterExpression中使用「IN」語句 - dynamodb
這是我嘗試
var params = {
TableName: "User",
IndexName:"a-b-index",
KeyConditionExpression: "Country = :country and #s = :status",
FilterExpression: "Id IN (:e)",
ExpressionAttributeValues: {
":country ": "USA",
":status": 1,
":e": "1"
},
ExpressionAttributeNames: {"#s": "Status"}
};
//get users
dynamodb.query(params, function (err, data) {
if (err)
//error
else {
//success
}
});
了記錄,但它是取它具有ID 1
紀錄,但我想用數組這樣
var params = {
TableName: "User",
IndexName:"a-b-index",
KeyConditionExpression: "Country = :country and #s = :status",
FilterExpression: "Id IN (:e)",
ExpressionAttributeValues: {
":country ": "USA",
":status": 1,
":e": ["1","2","3"]
},
ExpressionAttributeNames: {"#s": "Status"}
};
//get users
dynamodb.query(params, function (err, data) {
if (err)
//error
else {
//success
}
});
怎樣才能使上面的代碼爲working.want獲取記錄。語法沒有錯誤糾正和查詢運行,但我沒有得到記錄
你是怎麼測試它? –
@NiroshanRanapathi你是什麼意思? –
@NiroshanRanapathi我正在使用無服務器framework.checking本地 –