1

my dynamodb table contains items like this

data screenshot

I know i can use a projection like:

        proj := expression.NamesList(expression.Name("key_Ravenna"))

to filter my results by key, but how can I filter by contents of the maps? e.G. "WHERE LatD == 41"

Appreciate the help, just started migrating my mongodb application to dynamodb

1 Answer 1

1

You can access nested elements such as Maps using 'dot' notation:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Attributes.html#Expressions.Attributes.NestedAttributes

aws dynamodb scan --table-name YOURTABLE --filter-expression 'key_Reading.Data.LatD = :val' --expression-attribute-values '{":val":{"S":"41"}}'

I've used a scan as an example, which searches across across every item in your table, but you might want a query, only searches across one partition key.

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

2 Comments

OK, thank you. Is it possible to get the item from my post but it only returns "key_Reading" because LatD=41 ? Like a projection would work, but i don't know whitch key to project from the begining
Do you want to pass in the attribute name and/or value as a variable? You can just use the name of the variable, rather than a literal like "41.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.