带有节点js的dynamodb中的日期时基过滤器
Date time base filter in dynamodb with node js
我正在使用节点 js 开发 DynamoDB 项目,我想获取两个日期之间的一些数据。那么我可以为日期基础过滤器做些什么,请提供 nodejs 中的任何代码示例来解决这个问题。您可以假设我们必须在两个日期之间获取学生录取通知书。
您可以使用 BETWEEN
来过滤两个日期之间的项目。
BETWEEN : Greater than or equal to the first value, and less than or
equal to the second value.
查询的示例参数 API:-
var params = {
TableName : table,
KeyConditionExpression : 'yearkey = :hkey and title = :rkey',
FilterExpression : 'createdate between :val1 and :val2',
ExpressionAttributeValues : {
':hkey' : year_val,
':rkey' : title,
":val1" : "2010-12-21T16:42:31",
":val2" : "2010-12-21T17:42:35"
}
};
数据库项目:-
GetItem succeeded: {
"Items": [
{
"createdate": "2010-12-21T17:42:34Z",
"title": "The Big New Movie 2010",
"yearkey": 2010,
"info": {
"rating": 0,
"plot": "Nothing happens at all."
}
}
],
"Count": 1,
"ScannedCount": 1
}
我正在使用节点 js 开发 DynamoDB 项目,我想获取两个日期之间的一些数据。那么我可以为日期基础过滤器做些什么,请提供 nodejs 中的任何代码示例来解决这个问题。您可以假设我们必须在两个日期之间获取学生录取通知书。
您可以使用 BETWEEN
来过滤两个日期之间的项目。
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value.
查询的示例参数 API:-
var params = {
TableName : table,
KeyConditionExpression : 'yearkey = :hkey and title = :rkey',
FilterExpression : 'createdate between :val1 and :val2',
ExpressionAttributeValues : {
':hkey' : year_val,
':rkey' : title,
":val1" : "2010-12-21T16:42:31",
":val2" : "2010-12-21T17:42:35"
}
};
数据库项目:-
GetItem succeeded: {
"Items": [
{
"createdate": "2010-12-21T17:42:34Z",
"title": "The Big New Movie 2010",
"yearkey": 2010,
"info": {
"rating": 0,
"plot": "Nothing happens at all."
}
}
],
"Count": 1,
"ScannedCount": 1
}