-1

I've got a DynamoDB table containing 'n' Book title in only one dynamoDB Item (and this freak me out)

in this structure, rentBook is the table on dynamoDB, with 2 attributes:

String      StudentID 
StringSet   BookTitle // something like:["title1","title2","title3"]

In SQL I would have write something like that

SELECT StudentID
FROM   RentBook 
WHERE  BookTitle = "title1" OR BookTitle = "title2"

but with Dynamo i can't get the right results :( anyone can help me?

question 2: Is this table structure appropriate when the number of rows increases?

Community
  • 1
  • 1

1 Answers1

0

Try this:

ValueMap vm = new ValueMap().withString(":val1", "title1");
ScanRequest scanRequest = new ScanRequest()
            .withTableName("RentBook")
            .withFilterExpression("contains(BookTitle, :val1)")
            .withExpressionAttributeValues(vm);
Liat
  • 91
  • 4