DynamoDb List Map Types

-1

Hi, i have a table that has a list of map types, and i would like to filter on the description of that list using contains, is that possible within the C# SDK or even possible at all?

I have tried the following and all other combinations of it but i cant seem to get it to work.

            filterConditions.Add("contains(#detailAttr, :orderDetailsValue)");
            expressionAttributeNames.Add("#detailAttr", "OrderDetails[*].Description");
            expressionAttributeValues.Add(":orderDetailsValue", new AttributeValue { S = search });

DynamodbMap

asked 8 months ago705 views
1 Answer
1

Contains will not work unless you specify the entire map, as you don't iterate through the map, you are searching what the List contains. What would be a better solution is to have a map of maps, where you can use the search term as a key to your map, but that would mean the search term would need to be unique.

it would be simply, WHERE conatins(#mylist, :mymao). You need to match on a single element in the list.

Given a list of numbers:

  • [1,2,4,6,8]
  • conatins(#mylist, 3)

Given a list of maps:

  • [{a:b, a:c}, {b:b, b:c}, {c:b, c:c}]
  • conatins(#mylist, {b:b, b:c})
profile pictureAWS
EXPERT
answered 8 months ago
  • What would the contains filter expression look like if i want to stay with the List of maps? Seeing that i only have two fields.

  • Edited my answer.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions