Pra*_*kar 15 javascript amazon-dynamodb
我有一个分区键和排序键的表也有2个其他列.在使用javaScript AWS SDK的DynamoDB中,我无法使用FilterExpression获取包含AND的多个条件的项目.任何人都可以提供正确的代码来检索FilterExpression中具有多个条件的数据吗?我的代码如下:
var params = {
TableName: 'Department',
KeyConditionExpression: "#company = :companyId"
, ExpressionAttributeNames: {
'#company': 'CompanyID',
'#dType': 'DepartmentType',
'#cTime': 'CreatedTime"
}
, ExpressionAttributeValues: {
':companyId': 'Test',
':deptType': dType,
':daysPrior': 1250456879634
},FilterExpression: "#dType = :deptType AND #ts > :daysPrior"
};
Run Code Online (Sandbox Code Playgroud)
Sun*_*B N 22
查询格式中存在拼写错误(之后CreatedTime)为了保持其清洁,请使用双引号或单引号,但不能同时使用两个引号.我使用双引号,就像aws样本代码那样.
var params = {
TableName: "Department",
KeyConditionExpression: "#company = :companyId",
ExpressionAttributeNames: {
"#company": "CompanyID",
"#dType": "DepartmentType",
"#cTime": "CreatedTime" //here
},
ExpressionAttributeValues: {
":companyId": "Test",
":deptType": dType,
":daysPrior": 1250456879634
},
FilterExpression: "#dType = :deptType AND #ts > :daysPrior"
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14373 次 |
| 最近记录: |