Hello, how to do instead of Id = :first OR Id = :second condition with the use of IN ?

 public List<Data> getByIds(List<Long> ids) { Table table = dynamoDB.getTable(getTableName()); ScanSpec scanSpec = new ScanSpec() .withFilterExpression("Id = :first OR Id = :second") .withValueMap(new ValueMap() .withNumber(":first", ids.get(0)) .withNumber(":second", ids.get(1)) ); ItemCollection<ScanOutcome> scanOutcome = table.scan(scanSpec); return convertItemToData(scanOutcome.iterator()); } 

    1 answer 1

    As an option, you can do so

     { //... Condition condition = new Condition() .withComparisonOperator(ComparisonOperator.IN.toString()) .withAttributeValueList(buildAttributeValueList(userId)); ScanRequest scanRequest = new ScanRequest() .withTableName(getTableName()) .withScanFilter(ImmutableMap.of("userId", condition)); ScanResult scanResult = amazonDynamoDBClient.scan(scanRequest); 
    • one
      How to make an object with scanResult ? - jdev