我只是想问你,我怎样才能收到按创建日期按 ASC 排序的最新项目。
const getItems = async (limit) => {
const params = {
TableName,
KeyConditionExpression: '#field = :value',
ExpressionAttributeNames: {
'#field': 'pk',
},
ExpressionAttributeValues: {
':value': 'ITEM'
},
Limit: 3,
ScanIndexForward: true, // I think that it will sort by date, but it's probably sorting by pk...
};
return results.Items;
};
如何使用 dynamodb documentClient 接收 3 个最新创建的项目?
谢谢你的帮助!