Database Reference
In-Depth Information
keyConditions.put("productId", hashKeyCondition);
// Specify condition for index, here lastModifiedBy == Alice
Condition lastModCondition = new Condition()
.withComparisonOperator(ComparisonOperator.EQ.toString())
.withAttributeValueList(new
AttributeValue().withS("Alice"));
keyConditions.put("lastModifiedBy", lastModCondition);
Map lastEvaluatedKey = null;
do {
QueryRequest queryRequest = new QueryRequest()
.withTableName("ProductTable")
.withKeyConditions(keyConditions)
.withExclusiveStartKey(lastEvaluatedKey)
.withIndexName("lastModifiedBy-index");
QueryResult queryResult = client.query(queryRequest);
// Use query results
..
// check if there are more records for the query
lastEvaluatedKey = queryResult.getLastEvaluatedKey();
} while (lastEvaluatedKey != null)
iOS
Here is how we have to write queries to fetch an attribute modified by a certain user.
// Create our dictionary of conditions
NSDictionary *conditions = [NSMutableDictionary new];
// Specify the key conditions , here product id = 123
DynamoDBCondition *productIdCondition = [DynamoDBCondition
new];
condition.comparisonOperator = @"EQ";
DynamoDBAttributeValue *productId =
[[DynamoDBAttributeValue alloc] initWithN:@"123"];
Search WWH ::




Custom Search