Home > Software engineering >  What does DynamoDBMapper's query method return when value doesn't exist?
What does DynamoDBMapper's query method return when value doesn't exist?

Time:01-07

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.

  • Related