user1748253
user1748253

Reputation: 204

AWS DynamoDB Scan on Set attribute

How does scan work with Set Attribute Type (NS or SS). I like to provide some condition for retrieve a Set. For eg: in Table I have

{Item1: Attr1{NS : 1,2,3,4,5}}
{Item2: Attr1{NS : 6,7,8}}
{item3: Attr1{NS : 7,10}}

I'd like to take the Item2 and Item3 by giving some scan condition. Can any one help me with this?

Upvotes: 1

Views: 941

Answers (1)

Michael Hart
Michael Hart

Reputation: 5179

Use CONTAINS or NOT_CONTAINS as the ComparisonOperator of the ScanFilter (more info here: http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_Scan.html)

Eg:

{
  "TableName":"MyTable",
  "ScanFilter": {
    "Attr1": {
      "AttributeValueList": [{"N":"7"}],
      "ComparisonOperator": "CONTAINS"
    }
  }
}

This will return Item2 and Item3 because they both contain 7.

Upvotes: 2

Related Questions