Created
October 9, 2021 09:24
-
-
Save enricop89/89557d4374412fde989135b017eb8bd1 to your computer and use it in GitHub Desktop.
GSI Query Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findBookByGenreAndYear({genre, startYear, endYear}) { | |
var params = { | |
ExpressionAttributeValues: { | |
":genre": {"S": genre}, | |
":startYear": {"N": startYear}, | |
":endYear": {"N": endYear}, | |
}, | |
ExpressionAttributesNames:{ | |
"#genre": "Genre", | |
"#y": "Year", | |
}, | |
KeyConditionExpression: "#genre = :genre AND #y BETWEEN :startYear AND :endYear", | |
TableName: "Library", | |
IndexName: "GSI_1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment