I've implemented a scan query that fetches all the users from DynamoDb using NodeJS. Now I want to implement sorting on createdAt to bring the latest user or oldest user from DynamoDb. Still, as per doc, we can't apply any sorting on the scan query of DynamoDB so does anyone have an idea how can we implement sorting on the scan query of DynamoDB?
// Prepare param for scan table
let scanParam = {
TableName: userTableName,
FilterExpression: FilterExpressionRef.join(' AND '),
ExpressionAttributeValues: ExpressionAttributeValuesRef,
consistentRead : false,
ProjectionExpression: 'id, username, email, isCreator, displayName, gender, locationCountry, locationCity, coinBalance, coinPerHalfYear, coinPerMonth, coinPerYear, followerCount, followingCount, createdAt, updatedAt',
}