Hi I'm trying to see if a value exist in my GSI and if it is return the query result or otherwise throw an error. I was wondering if the query method from the DynamoDBMapper class is the right one to use and what it returns when a value doesn't exist? As it doesn't seem to say in their doc. Thanks!
CodePudding user response:
All DynamoDB clients return an empty response if an item does not exist. It would not return an error because the request was successful, the item just did not exist.
From the docs:
A Query operation always returns a result set. If no matching items are found, the result set will be empty. Queries that do not return results consume the minimum number of read capacity units for that type of read operation.