0

Is it possible to apply a filter based on values inside a dynamodb database? Let's say the database contains an object info within a table:

info: {
    toDo: x,
    done: y,
}

Using the ExpressionAttributeValues, is it possible to check whether the info.toDo = info.done and apply a filter on it without knowing the current values of info.toDo and info.done ?

At the moment I tried using ExpressionAttributeNames so it contains:

'#toDo': info.toDo, '#done': info.done'

and the filter FilterExpression is

#toDo = #done

but I'm retrieving no items doing a query with this filter.

Thanks a lot!

1
  • It seems like there is no option for this in DynamoDB :( Commented Jul 19, 2022 at 4:29

1 Answer 1

0

DynamoDB is not designed to perform arbitrary queries as you might be used to in a relational database. It is designed for fast lookups based on keys.

Therefore, if you can add an index allowing you to access the records you look for, you can use it for this new access pattern. For example, if you add an index that uses info.toDo as the partition key and info.done as the sort key. You can then use the index to scan the records with the conditional expression of PK=x and SK=x, assuming that the list of possible values is limited and known.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.