[英]Query with 3 parameters to dynamodb with dynamoose
I am trying to consult a DynamoDB table with 3 parameters, but it does not work. 我正在尝试使用3个参数查询DynamoDB表,但是它不起作用。 However, with 1 parameter it works perfectly.
但是,使用1参数可以完美地工作。
I'm work with NodeJs, DynamoDB, Dynamoose... and here is my code: 我正在使用NodeJ,DynamoDB,Dynamoose ...,这是我的代码:
var params = {
TableName: "DifferentTermsPages",
KeyConditionExpression:"#providerName = :providerName and #productType = :productType and #language = :language",
ExpressionAttributeNames: {
"#providerName":"providerName",
"#productType":"productType",
"#language":"language"
},
ExpressionAttributeValues: {
":providerName":providerName,
":productType":productType,
":language":language
}
};
OcrController.getDifferencesFromDB(params)
.then(function(dataDB) {
console.log("DATA = ", dataDB);
}).catch(function(err) {
console.error(err);
});
Call to another function with a promise: 承诺调用另一个函数:
getDifferencesFromDB(params) {
return new Promise(function(resolve, reject) {
DifferentTermsPagesModel.scan(params).exec().then(function (err, data) {
if(err) {
reject(err);
}
else {
console.log("OK!!");
resolve(data);
}
});
});
}
The error that shows me... 显示我的错误...
TypeError: Cannot read property 'toDynamo' of undefined
at Scan.exec (/API/src/node_modules/dynamoose/lib/Scan.js:57:23)
at ...
Where is my error?? 我的错误在哪里? How can I resolve it?
我该如何解决? Or another form to make this...
或另一种形式来做到这一点...
在使用扫描API时 ,请使用FilterExpression
而不是KeyConditionExpression
。
FilterExpression:"#providerName = :providerName AND #productType = :productType AND #language = :language",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.