H.Molnar
H.Molnar

Reputation: 92

Dynamodb projection by map contents

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

Greetings H.Molnar

Upvotes: 1

Views: 1036

Answers (1)

F_SO_K
F_SO_K

Reputation: 14829

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.

Upvotes: 1

Related Questions